# Transform troubleshooting

Common Custom Local JavaScript and AI transform issues.

## My Local JavaScript transform did not change the text

If a Local JavaScript transform fails, Nibit preserves the original input. Check the transform's details/logs panel for the most recent error.

Common causes:

- the function did not return a string
- the script threw an error
- the script timed out or used too much memory
- the source is larger than 128 KB
- the transform uses APIs that are not available in v1, such as network or filesystem access

## “Transform must return a string”

Return a string from `transform`:

```js
async function transform(input, nibit) {
  return String(input).trim()
}
```

Returning an array, object, number, `undefined`, or `null` is treated as an error.

## Regex source caused an error in an older build

Local JavaScript source is not a prompt template. Current Nibit builds run Local JavaScript directly and do not parse JavaScript braces as prompt placeholders.

For example, this is valid:

```js
async function transform(input, nibit) {
  return input.replace(/\s{2,}/g, ' ')
}
```

## I cannot import or export `.nibit-transform` files

Check your plan:

- Android import/export requires Local Pro or Cloud Pro.
- Web dashboard import/export requires Cloud Pro.

Also confirm the file has:

- valid JSON
- `"kind": "nibit_transform_bundle"`
- `"schema_version": 1`
- a `transforms` array (it may be empty; empty bundles import as a no-op)

## I see duplicate names after import

That is expected for `.nibit-transform` files. Nibit imports transform bundles as new transforms and does not overwrite existing transforms with the same name.

Full Nibit backup restore has different semantics: when a saved transform has cloud identity metadata, restore preserves that identity so sync does not create a duplicate cloud transform.

## My logs are missing input/output text

Nibit intentionally avoids storing raw input and output in Local JavaScript execution logs by default. Logs show useful metadata such as duration, success/failure, input length, output length, error summary, and any log lines written by your script.

Avoid logging sensitive text from your own transform if you do not want it to appear in local logs.

## AI transform is unavailable

AI transforms require Cloud Pro and an internet connection. Local JavaScript transforms do not use AI provider settings.
