{"record":{"id":"dfc04f15f2504f79","repo":"n8n-io/n8n","slug":"daytona-api-key-is-required-for-sandbox-provider","errorCode":null,"errorMessage":"DAYTONA_API_KEY is required for sandbox provider \"daytona\". Set the Daytona API key.","messagePattern":"DAYTONA_API_KEY is required for sandbox provider \"daytona\"\\. Set the Daytona API key\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/harness/sandbox-config.ts","lineNumber":43,"sourceCode":"\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);\n\t\t}\n\t\tconst image = env.N8N_INSTANCE_AI_SANDBOX_IMAGE;\n\t\tconst namePrefix = env.N8N_INSTANCE_AI_SANDBOX_NAME_PREFIX;\n\t\tconst createTimeoutSeconds =\n\t\t\tparsePositiveInt(\n\t\t\t\tenv.N8N_INSTANCE_AI_SANDBOX_CREATE_TIMEOUT_SECONDS,\n\t\t\t\t'N8N_INSTANCE_AI_SANDBOX_CREATE_TIMEOUT_SECONDS',\n\t\t\t) ?? DEFAULT_DAYTONA_CREATE_TIMEOUT_SECONDS;\n\t\treturn {\n\t\t\tenabled: true,\n\t\t\tprovider: 'daytona',\n\t\t\tdaytonaApiUrl,\n\t\t\tdaytonaApiKey,\n\t\t\ttimeout,\n\t\t\tcreateTimeoutSeconds,\n\t\t\t...(image ? { image } : {}),","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/harness/sandbox-config.ts#L25-L61","documentation":"Thrown by resolveSandboxConfig when provider is 'daytona' and DAYTONA_API_URL is present but DAYTONA_API_KEY is missing. The API key authenticates sandbox provisioning calls; without it the harness cannot create workspaces.","triggerScenarios":"Daytona provider selected, URL set, but the key was not injected (e.g. secret manager omitted it); the key var name was typo'd.","commonSituations":"CI secrets not wired for this run; local .env missing the key; rotating keys and forgetting to update the env.","solutions":["Set DAYTONA_API_KEY to a valid Daytona API key for the account associated with DAYTONA_API_URL.","Verify the variable is present in the eval process env (print `process.env.DAYTONA_API_KEY ? 'set' : 'missing'`).","If you did not intend daytona, switch the provider back to 'n8n-sandbox'."],"exampleFix":"# before\nexport DAYTONA_API_URL=https://app.daytona.io/api\n# DAYTONA_API_KEY unset\n\n# after — inject via secret manager, never hardcode\nexport DAYTONA_API_URL=https://app.daytona.io/api\nexport DAYTONA_API_KEY=$DAYTONA_API_KEY  # from vault/secret manager","handlingStrategy":"validation","validationCode":"function daytonaKeyPresent(env: NodeJS.ProcessEnv): boolean {\n  return env.N8N_INSTANCE_AI_SANDBOX_PROVIDER !== 'daytona' || !!env.DAYTONA_API_KEY;\n}\n\nif (!daytonaKeyPresent(process.env)) {\n  throw new Error('DAYTONA_API_KEY missing; inject via secret manager');\n}","typeGuard":"null","tryCatchPattern":"try {\n  resolveSandboxConfig(process.env);\n} catch (e) {\n  if (e instanceof Error && /DAYTONA_API_KEY is required/.test(e.message)) {\n    // surface to secret manager / CI injection, do NOT log a value\n  }\n  throw e;\n}","preventionTips":["Never hardcode the key; inject via vault/secret manager.","Pair DAYTONA_API_URL and DAYTONA_API_KEY in the same injection step.","Fail fast at startup with a config self-check."],"tags":["configuration","env-vars","sandbox","daytona","secrets"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}