n8n-io/n8n · error · SandboxWorkspaceSetupError

Sandbox workspace setup failed during

Error message

Sandbox workspace setup failed during ${step}: ${getErrorMessage(originalError)}

What it means

SandboxWorkspaceSetupError wraps any failure raised inside a named setupStep of setupSandboxWorkspace (workspace creation, file writes, dependency install, knowledge base, etc.). The message identifies which step failed and chains the original error message; the type name lets callers distinguish setup failures from other errors.

Solutions

  1. Read the step name and chained message to find the root cause
  2. Fix the environment (network, npm access, sandbox backend) and retry workspace setup
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/@n8n/instance-ai/src/workspace/sandbox-setup.ts:82 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/492e6b4c49033177. Report an issue: GitHub.

Appendix: source

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

function getErrorMessage(error: unknown): string {
	return error instanceof Error ? error.message : String(error);
}

export class SandboxWorkspaceSetupError extends Error {
	constructor(
		readonly step: SandboxWorkspaceSetupStep,
		readonly originalError: unknown,
	) {
		super(`Sandbox workspace setup failed during ${step}: ${getErrorMessage(originalError)}`);
		this.name = 'SandboxWorkspaceSetupError';
	}
}

async function setupStep<T>(step: SandboxWorkspaceSetupStep, action: () => Promise<T>): Promise<T> {
	try {
		return await action();
	} catch (error) {
		throw new SandboxWorkspaceSetupError(step, error);
	}
}

/**
 * Resolve a dependency's installed version from the host's node_modules.
 * Falls back to `'*'` if the package is unresolvable (should only happen in
 * out-of-tree test setups — production always has these as real deps).
 */
function resolveHostDepVersion(name: string): string {
	try {
		const pkg = hostRequire(`${name}/package.json`) as { version?: string };
		return pkg.version ?? '*';
	} catch {
		return '*';
	}
}

/**

View on GitHub (pinned to 5ac6606e81)