n8n-io/n8n · error
mkdir exited with code
Error message
mkdir exited with code ${result.exitCode} What it means
In createWorkspaceDirectory, after filesystem.mkdir failed, the `mkdir -p` command fallback in the sandbox succeeded process-wise but returned a non-zero exit code with empty stderr — the exit code is reported as the only diagnostic.
Solutions
- Re-run the operation to see if the failure is transient
- Check the path for invalid characters or sandbox permission problems
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/@n8n/instance-ai/src/workspace/sandbox-setup.ts:355 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/8fe8ee6dc9a1d2ee.
Report an issue: GitHub.
Appendix: source
Thrown at packages/@n8n/instance-ai/src/workspace/sandbox-setup.ts:355
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 {
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 {View on GitHub (pinned to 5ac6606e81)