> ## Documentation Index
> Fetch the complete documentation index at: https://www.nexrender.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox and limits

> What scripts can do on Nexrender Cloud, the limits that apply, and how to read sandbox errors

By default, Nexrender Cloud runs every script in a sandbox. Inside it, a script works with two things: the job's After Effects project and the job's folder. It can't reach the rest of the render node.

## What scripts can do

* **Use the After Effects scripting API on the job's project.** Compositions, layers, properties, expressions, footage, and the render queue all work as they do in After Effects.
* **Read and write files in the job's folder.** Build paths from `NX.get("nxWorkpath")`. Relative paths, and paths that start with `~/`, also resolve to the job's folder. `Folder.temp`, `Folder.desktop`, `Folder.myDocuments`, `Folder.userData`, and `Folder.appData` point to folders inside it.
* **Load other script files from the job's folder** with `$.evalFile`, for example a library you download with a `static` asset.
* **Use data from outside the job** by downloading it with a [`static` asset](https://www.nexrender.com/docs/cloud/scripting/examples#read-data-from-a-json-file). Nexrender downloads it into the job's folder before your script runs, so your script reads it like any other file.

Pass everything else a script needs, such as text, settings, and paths, as [parameters](https://www.nexrender.com/docs/cloud/scripting/script-assets.md). If your workflow needs something the sandbox doesn't allow, contact [support@nexrender.com](mailto:support@nexrender.com).

> [!TIP]
>
> Render nodes run Windows or macOS. Build paths with forward slashes, such as `NX.get("nxWorkpath") + "/report.txt"`. After Effects accepts them on both.

## Limits

A script can write up to 500 MB to files. Writing more stops the job with a `file_write_limit` error.

## Rules for every script

* **No preprocessor directives.** The API accepts the job, but the job fails before rendering if a script uses `#include`, `#includepath`, or `#targetengine`. To share code between scripts, download it with a `static` asset and load it with `$.evalFile`. See [Load shared code](https://www.nexrender.com/docs/cloud/scripting/examples.md#load-shared-code-from-another-file).
* **Dialogs don't stop the render.** `alert`, `confirm`, and `prompt` write their message to the render log instead of opening a dialog. `confirm` returns `false` and `prompt` returns `null`.
* **Leave render output paths as they are.** Nexrender sets the job's output itself.

## Sandbox errors

When a script does something the sandbox doesn't allow, the job fails before rendering. Its error starts with `nexrender: sandbox violation` and a code:

```text Job error theme={null}
Error: nexrender: sandbox violation [file_outside_workpath] file construct outside sandbox workpath: .../outside.txt
```

The check happens as soon as the script creates the `File` or `Folder` object, before anything is read or written.

| Code | Cause | Fix |
| - | - | - |
| `file_outside_workpath` | A file or folder path points outside the job's folder. | Build the path from `NX.get("nxWorkpath")`. |
| `file_path_blocked` | A path is ambiguous, such as `C:file.txt`, or a rename target isn't a plain file name. | Use a full path, and rename to a name without slashes. |
| `file_protocol_blocked` | A file path is a URL instead of a path. | Download the file with a `static` asset first. |
| `file_write_limit` | The script wrote more than 500 MB. | Write less, or split the work across jobs. |
| `file_dialog_blocked` | The script opened a file or folder dialog. | Pass the path as a parameter. |
| Any other code | The script used a feature the sandbox doesn't allow. | Remove that call. If you need it, contact [support@nexrender.com](mailto:support@nexrender.com). |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.