{"record":{"id":"6603b493d4034d61","repo":"n8n-io/n8n","slug":"n8n-instance-ai-sandbox-timeout-must-be-a-positive","errorCode":null,"errorMessage":"N8N_INSTANCE_AI_SANDBOX_TIMEOUT must be a positive number of ms, got \"${raw}\".","messagePattern":"N8N_INSTANCE_AI_SANDBOX_TIMEOUT must be a positive number of ms, got \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/harness/sandbox-config.ts","lineNumber":93,"sourceCode":"\t\t\tenabled: true,\n\t\t\tprovider: 'n8n-sandbox',\n\t\t\tserviceUrl,\n\t\t\t...(apiKey ? { apiKey } : {}),\n\t\t\ttimeout,\n\t\t};\n\t}\n\n\tconst exhaustiveProvider: never = provider;\n\tthrow new Error(\n\t\t`Invalid sandbox provider \"${String(exhaustiveProvider)}\". Set N8N_INSTANCE_AI_SANDBOX_PROVIDER to one of: ${VALID_PROVIDERS.join(', ')}.`,\n\t);\n}\n\nfunction parseTimeout(raw: string | undefined): number | undefined {\n\tif (raw === undefined || raw === '') return undefined;\n\tconst n = Number(raw);\n\tif (!Number.isFinite(n) || n <= 0) {\n\t\tthrow new Error(\n\t\t\t`N8N_INSTANCE_AI_SANDBOX_TIMEOUT must be a positive number of ms, got \"${raw}\".`,\n\t\t);\n\t}\n\treturn n;\n}\n\nfunction parsePositiveInt(raw: string | undefined, varName: string): number | undefined {\n\tif (raw === undefined || raw === '') return undefined;\n\tconst n = Number(raw);\n\tif (!Number.isFinite(n) || n <= 0 || !Number.isInteger(n)) {\n\t\tthrow new Error(`${varName} must be a positive integer, got \"${raw}\".`);\n\t}\n\treturn n;\n}\n","sourceCodeStart":75,"sourceCodeEnd":108,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/harness/sandbox-config.ts#L75-L108","documentation":"Thrown by parseTimeout when N8N_INSTANCE_AI_SANDBOX_TIMEOUT is set to a value that is not a finite positive number (ms). Empty/undefined is allowed (returns the default), but a present non-numeric, zero, negative, NaN, or Infinity value is rejected.","triggerScenarios":"Setting the timeout to '0', '-1', 'abc', '5s' (units are not supported — raw ms only), or 'Infinity'.","commonSituations":"Operator expects seconds and writes '300' meaning 300s but getting 300ms; typo including a unit suffix; copy-pasting a value formatted for a different tool.","solutions":["Set N8N_INSTANCE_AI_SANDBOX_TIMEOUT to a positive integer number of milliseconds, e.g. 300000 for 5 minutes.","If you wrote seconds, multiply by 1000.","Remove units/suffixes — only a bare number is accepted."],"exampleFix":"# before\nexport N8N_INSTANCE_AI_SANDBOX_TIMEOUT=300s\n\n# after — milliseconds, no unit\nexport N8N_INSTANCE_AI_SANDBOX_TIMEOUT=300000","handlingStrategy":"validation","validationCode":"function timeoutValid(raw: string | undefined): boolean {\n  if (raw === undefined || raw === '') return true; // default applies\n  const n = Number(raw);\n  return Number.isFinite(n) && n > 0;\n}\n\nif (!timeoutValid(process.env.N8N_INSTANCE_AI_SANDBOX_TIMEOUT)) {\n  throw new Error('timeout must be positive finite ms');\n}","typeGuard":"function isPositiveMs(raw: string): boolean {\n  const n = Number(raw);\n  return Number.isFinite(n) && n > 0;\n}","tryCatchPattern":"try {\n  resolveSandboxConfig(process.env);\n} catch (e) {\n  if (e instanceof Error && /N8N_INSTANCE_AI_SANDBOX_TIMEOUT/.test(e.message)) {\n    delete process.env.N8N_INSTANCE_AI_SANDBOX_TIMEOUT; // fall back to default\n    resolveSandboxConfig(process.env);\n  } else throw e;\n}","preventionTips":["Document that the unit is milliseconds, not seconds.","Reject unit suffixes in env-var linting.","Provide the default value in config templates so operators rarely set it."],"tags":["configuration","env-vars","validation","timeout"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}