n8n-io/n8n · error
Failed to create sandbox workspace directory
Error message
Failed to create sandbox workspace directory "${path}": ${getErrorMessage(error)}; command fallback failed: ${getErrorMessage(fallbackError)} What it means
createWorkspaceDirectory tried the filesystem API first, then a `mkdir -p` shell fallback; both failed. The message chains both error messages (API error; fallback error) so the primary and fallback causes are both visible for the given path.
Solutions
- Compare both chained messages to find the common cause (bad path, read-only sandbox)
- Fix the sandbox/filesystem backend and retry workspace setup
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/@n8n/instance-ai/src/workspace/sandbox-setup.ts:357 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/a40cdfb26ff5f84c.
Report an issue: GitHub.
Appendix: source
Thrown at packages/@n8n/instance-ai/src/workspace/sandbox-setup.ts:357
}
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 {
const result = await runInSandbox(workspace, `mkdir -p '${escapeSingleQuotes(path)}'`);
if (result.exitCode === 0) return;
throw new Error(result.stderr || `mkdir exited with code ${result.exitCode}`);
} catch (fallbackError) {
throw new Error(
`Failed to create sandbox workspace directory "${path}": ${getErrorMessage(error)}; command fallback failed: ${getErrorMessage(fallbackError)}`,
);
}
}
}
async function writeWorkspaceFile(
workspace: SandboxWorkspace,
filesystem: WorkspaceFilesystem,
path: string,
content: string | Buffer,
): Promise<void> {
try {
await filesystem.writeFile(path, content, { recursive: true });
} catch (error) {
try {
await writeFileViaSandbox(workspace, path, content);
} catch (fallbackError) {View on GitHub (pinned to 5ac6606e81)