{"record":{"id":"ee722a15024f9ccf","repo":"n8n-io/n8n","slug":"invalid-sandbox-provider-providerraw-set-n8n","errorCode":null,"errorMessage":"Invalid sandbox provider \"${providerRaw}\". Set N8N_INSTANCE_AI_SANDBOX_PROVIDER to one of: ${VALID_PROVIDERS.join(', ')}.","messagePattern":"Invalid sandbox provider \"(.+?)\"\\. Set N8N_INSTANCE_AI_SANDBOX_PROVIDER to one of: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/harness/sandbox-config.ts","lineNumber":27,"sourceCode":"// required env vars raise clear errors so misconfiguration shows up at\n// startup, not mid-run.\n// ---------------------------------------------------------------------------\n\nimport type { SandboxConfig, SandboxProvider } from '../../src/workspace/create-workspace';\n\nconst DEFAULT_TIMEOUT_MS = 300_000;\n/**\n * Default cold-build window for Daytona's first sandbox provisioning. The\n * image runs `npm install @n8n/workflow-sdk` which routinely takes longer\n * than the SDK's 300s default; 900s avoids spurious eval-run failures.\n */\nconst DEFAULT_DAYTONA_CREATE_TIMEOUT_SECONDS = 900;\nconst VALID_PROVIDERS: SandboxProvider[] = ['n8n-sandbox', 'daytona'];\n\nexport function resolveSandboxConfig(env: NodeJS.ProcessEnv): SandboxConfig {\n\tconst providerRaw = env.N8N_INSTANCE_AI_SANDBOX_PROVIDER ?? 'n8n-sandbox';\n\tif (!VALID_PROVIDERS.includes(providerRaw as SandboxProvider)) {\n\t\tthrow new Error(\n\t\t\t`Invalid sandbox provider \"${providerRaw}\". Set N8N_INSTANCE_AI_SANDBOX_PROVIDER to one of: ${VALID_PROVIDERS.join(', ')}.`,\n\t\t);\n\t}\n\tconst provider = providerRaw as SandboxProvider;\n\tconst timeout = parseTimeout(env.N8N_INSTANCE_AI_SANDBOX_TIMEOUT) ?? DEFAULT_TIMEOUT_MS;\n\n\tif (provider === 'daytona') {\n\t\tconst daytonaApiUrl = env.DAYTONA_API_URL;\n\t\tconst daytonaApiKey = env.DAYTONA_API_KEY;\n\t\tif (!daytonaApiUrl) {\n\t\t\tthrow new Error(\n\t\t\t\t'DAYTONA_API_URL is required for sandbox provider \"daytona\". Set it to e.g. https://app.daytona.io/api.',\n\t\t\t);\n\t\t}\n\t\tif (!daytonaApiKey) {\n\t\t\tthrow new Error(\n\t\t\t\t'DAYTONA_API_KEY is required for sandbox provider \"daytona\". Set the Daytona API key.',\n\t\t\t);","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/harness/sandbox-config.ts#L9-L45","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set N8N_INSTANCE_AI_SANDBOX_PROVIDER to exactly 'n8n-sandbox' or 'daytona' (lowercase, no whitespace).","If a different provider is required, upgrade the harness so VALID_PROVIDERS includes it.","Unset the variable to fall back to the default 'n8n-sandbox' if that is acceptable."],"exampleFix":"# before\nexport N8N_INSTANCE_AI_SANDBOX_PROVIDER=docker\n\n# after\nexport N8N_INSTANCE_AI_SANDBOX_PROVIDER=daytona","handlingStrategy":"validation","validationCode":"const VALID_PROVIDERS = ['n8n-sandbox', 'daytona'] as const;\nfunction isValidProvider(v: string | undefined): boolean {\n  return v === undefined || (VALID_PROVIDERS as readonly string[]).includes(v);\n}\n\nif (!isValidProvider(process.env.N8N_INSTANCE_AI_SANDBOX_PROVIDER)) {\n  throw new Error(`unsupported provider; valid: ${VALID_PROVIDERS.join(', ')}`);\n}","typeGuard":"function isSandboxProvider(v: string): v is 'n8n-sandbox' | 'daytona' {\n  return v === 'n8n-sandbox' || v === 'daytona';\n}","tryCatchPattern":"try {\n  resolveSandboxConfig(process.env);\n} catch (e) {\n  if (e instanceof Error && /Invalid sandbox provider/.test(e.message)) {\n    process.env.N8N_INSTANCE_AI_SANDBOX_PROVIDER = 'n8n-sandbox'; // default\n    resolveSandboxConfig(process.env);\n  } else throw e;\n}","preventionTips":["Document the accepted provider values wherever the env var is referenced.","Trim whitespace from env values before validation.","Add a startup config self-test in CI."],"tags":["configuration","env-vars","sandbox","validation"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}