n8n-io/n8n · error

Sandbox setup failed

Error message

Sandbox setup failed: ${result.stderr}

What it means

Fallback path of writeWorkspaceFiles: when no filesystem API is available, it creates the always-present directories via `mkdir -p` in the sandbox; that command exited non-zero and its stderr is surfaced. This means the workspace skeleton could not be prepared.

Solutions

  1. Inspect the stderr for the failing directory/path
  2. Fix sandbox permissions or path issues and retry setup
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/@n8n/instance-ai/src/workspace/sandbox-setup.ts:333 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/05828f748df4f0e8. Report an issue: GitHub.

Appendix: source

Thrown at packages/@n8n/instance-ai/src/workspace/sandbox-setup.ts:333

				async (dir) =>
					await createWorkspaceDirectory(workspace, filesystem, joinWorkspacePath(root, dir)),
			),
		);
		await Promise.all(
			[...files].map(
				async ([path, content]) =>
					await writeWorkspaceFile(workspace, filesystem, joinWorkspacePath(root, path), content),
			),
		);
		return;
	}

	const dirList = ALWAYS_PRESENT_DIRS.map(
		(dir) => `'${escapeSingleQuotes(joinWorkspacePath(root, dir))}'`,
	).join(' ');
	const result = await runInSandbox(workspace, `mkdir -p ${dirList}`);
	if (result.exitCode !== 0) {
		throw new Error(`Sandbox setup failed: ${result.stderr}`);
	}

	for (const [path, content] of files) {
		await writeFileViaSandbox(workspace, joinWorkspacePath(root, path), content);
	}
}

type WorkspaceFilesystem = NonNullable<SandboxWorkspace['filesystem']>;

async function createWorkspaceDirectory(
	workspace: SandboxWorkspace,
	filesystem: WorkspaceFilesystem,
	path: string,
): Promise<void> {
	try {
		await filesystem.mkdir(path, { recursive: true });
	} catch (error) {
		try {

View on GitHub (pinned to 5ac6606e81)