n8n-io/n8n · error · Error

Invalid sandbox provider "${providerRaw}". Set N8N_INSTANCE_

Error message

Invalid sandbox provider "${providerRaw}". Set N8N_INSTANCE_AI_SANDBOX_PROVIDER to one of: ${VALID_PROVIDERS.join(', ')}.

What it means

Thrown by resolveSandboxConfig when N8N_INSTANCE_AI_SANDBOX_PROVIDER is set to a value not in VALID_PROVIDERS (currently 'n8n-sandbox' and 'daytona'). The error lists the accepted values so the operator can correct the env var without consulting docs.

Source

Thrown at packages/@n8n/instance-ai/evaluations/harness/sandbox-config.ts:27

// required env vars raise clear errors so misconfiguration shows up at
// startup, not mid-run.
// ---------------------------------------------------------------------------

import type { SandboxConfig, SandboxProvider } from '../../src/workspace/create-workspace';

const DEFAULT_TIMEOUT_MS = 300_000;
/**
 * Default cold-build window for Daytona's first sandbox provisioning. The
 * image runs `npm install @n8n/workflow-sdk` which routinely takes longer
 * than the SDK's 300s default; 900s avoids spurious eval-run failures.
 */
const DEFAULT_DAYTONA_CREATE_TIMEOUT_SECONDS = 900;
const VALID_PROVIDERS: SandboxProvider[] = ['n8n-sandbox', 'daytona'];

export function resolveSandboxConfig(env: NodeJS.ProcessEnv): SandboxConfig {
	const providerRaw = env.N8N_INSTANCE_AI_SANDBOX_PROVIDER ?? 'n8n-sandbox';
	if (!VALID_PROVIDERS.includes(providerRaw as SandboxProvider)) {
		throw new Error(
			`Invalid sandbox provider "${providerRaw}". Set N8N_INSTANCE_AI_SANDBOX_PROVIDER to one of: ${VALID_PROVIDERS.join(', ')}.`,
		);
	}
	const provider = providerRaw as SandboxProvider;
	const timeout = parseTimeout(env.N8N_INSTANCE_AI_SANDBOX_TIMEOUT) ?? DEFAULT_TIMEOUT_MS;

	if (provider === 'daytona') {
		const daytonaApiUrl = env.DAYTONA_API_URL;
		const daytonaApiKey = env.DAYTONA_API_KEY;
		if (!daytonaApiUrl) {
			throw new Error(
				'DAYTONA_API_URL is required for sandbox provider "daytona". Set it to e.g. https://app.daytona.io/api.',
			);
		}
		if (!daytonaApiKey) {
			throw new Error(
				'DAYTONA_API_KEY is required for sandbox provider "daytona". Set the Daytona API key.',
			);

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Set N8N_INSTANCE_AI_SANDBOX_PROVIDER to exactly 'n8n-sandbox' or 'daytona' (lowercase, no whitespace).
  2. If a different provider is required, upgrade the harness so VALID_PROVIDERS includes it.
  3. Unset the variable to fall back to the default 'n8n-sandbox' if that is acceptable.

Example fix

# before
export N8N_INSTANCE_AI_SANDBOX_PROVIDER=docker

# after
export N8N_INSTANCE_AI_SANDBOX_PROVIDER=daytona
Defensive patterns

Strategy: validation

Validate before calling

const VALID_PROVIDERS = ['n8n-sandbox', 'daytona'] as const;
function isValidProvider(v: string | undefined): boolean {
  return v === undefined || (VALID_PROVIDERS as readonly string[]).includes(v);
}

if (!isValidProvider(process.env.N8N_INSTANCE_AI_SANDBOX_PROVIDER)) {
  throw new Error(`unsupported provider; valid: ${VALID_PROVIDERS.join(', ')}`);
}

Type guard

function isSandboxProvider(v: string): v is 'n8n-sandbox' | 'daytona' {
  return v === 'n8n-sandbox' || v === 'daytona';
}

Try / catch

try {
  resolveSandboxConfig(process.env);
} catch (e) {
  if (e instanceof Error && /Invalid sandbox provider/.test(e.message)) {
    process.env.N8N_INSTANCE_AI_SANDBOX_PROVIDER = 'n8n-sandbox'; // default
    resolveSandboxConfig(process.env);
  } else throw e;
}

Prevention

When it happens

Trigger: Typo in the provider name (e.g. 'daytona ' with trailing space, 'N8N-sandbox' wrong case, 'docker'); a provider value from a newer/older version that this harness build does not recognise; an empty string explicitly set.

Common situations: Copy-pasting a provider name with different casing; referencing a provider that exists in production but not in this older eval harness; CI env var typo.

Related errors


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