n8n-io/n8n · error
Sandbox does not support command execution
Error message
Sandbox does not support command execution
What it means
The execute-command tool checks `sandbox.executeCommand` (truthiness) before invoking it. Some sandbox implementations only provide `processes.spawn` and don't implement executeCommand; the tool requires the higher-level executeCommand API, so it refuses to run on such sandboxes rather than calling a missing method.
Source
Thrown at packages/@n8n/agents/src/workspace/tools/execute-command.ts:28
.input(
z.object({
command: z.string().describe('The shell command to execute'),
cwd: z.string().optional().describe('Working directory for the command'),
timeout: z.number().optional().describe('Timeout in milliseconds'),
}),
)
.output(
z.object({
success: z.boolean(),
exitCode: z.number(),
stdout: z.string(),
stderr: z.string(),
executionTimeMs: z.number(),
}),
)
.handler(async (input, ctx) => {
if (!sandbox.executeCommand) {
throw new Error('Sandbox does not support command execution');
}
const env = sandbox.getDefaultCommandEnv?.();
const result = await sandbox.executeCommand(input.command, undefined, {
cwd: input.cwd,
...(env ? { env } : {}),
timeout: input.timeout,
abortSignal: ctx.abortSignal,
});
return {
success: result.success,
exitCode: result.exitCode,
stdout: result.stdout,
stderr: result.stderr,
executionTimeMs: result.executionTimeMs,
};
})
.build();
}View on GitHub (pinned to 5ac6606e81)
Solutions
- Use a sandbox that implements executeCommand (e.g. DaytonaSandbox), or don't register the execute-command tool.
- If building a custom sandbox, implement executeCommand(command, args, options) returning {success, exitCode, stdout, stderr}.
- Route command execution through runInSandbox() which falls back to processes.spawn when executeCommand is absent.
Example fix
// before: custom sandbox only implements spawn
class MySandbox implements WorkspaceSandbox {
processes = new ProcManager();
// no executeCommand
}
// after
class MySandbox implements WorkspaceSandbox {
processes = new ProcManager();
async executeCommand(cmd, _args, opts) {
return /* delegate to processes.spawn */;
}
} Defensive patterns
Strategy: type-guard
Validate before calling
function supportsExec(sandbox: unknown): sandbox is { executeCommand: NonNullable<unknown> } {
return typeof sandbox === 'object' && sandbox !== null && 'executeCommand' in sandbox && typeof (sandbox as { executeCommand?: unknown }).executeCommand === 'function';
}
if (!supportsExec(sandbox)) throw new Error('this sandbox cannot run execute-command'); Type guard
function supportsExec(sandbox: unknown): sandbox is { executeCommand: (...args: unknown[]) => unknown } {
return Boolean(sandbox) && typeof (sandbox as { executeCommand?: unknown }).executeCommand === 'function';
} Prevention
- Only register the execute-command tool against sandboxes that implement it (Daytona).
- For spawn-only sandboxes, route through runInSandbox() which falls back to processes.spawn.
- Implement executeCommand in custom sandbox adapters.
When it happens
Trigger: Registering the execute-command tool against a sandbox whose executeCommand is undefined (a sandbox that only implements processes.spawn). Mixing a spawn-only sandbox with the execute-command tool.
Common situations: A custom WorkspaceSandbox implementation that omits executeCommand; using a minimal/local sandbox shim that only implements spawn; version skew between the tool registry and a sandbox adapter.
Related errors
- Sandbox "${this.name}" has been destroyed
- Sandbox "${this.name}" failed to start (status: ${this.statu
- Daytona sandbox "${this.id}" is not running
- Workspace has no sandbox
- File "${input.path}" is not loaded.
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/ba47c893573c076d.
Report an issue: GitHub.