{"record":{"id":"08459da0e513b8a6","repo":"mastra-ai/mastra","slug":"name-must-be-greater-than-zero","errorCode":null,"errorMessage":"${name} must be greater than zero.","messagePattern":"(.+?) must be greater than zero\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deployers/sandbox/src/worker.ts","lineNumber":183,"sourceCode":"  }\n  validateExecutionId(options.executionId);\n  if (!options.command || /[\\0\\r\\n]/.test(options.command)) {\n    throw new Error('Worker command must be a non-empty executable path.');\n  }\n  if (options.args?.some(arg => arg.includes('\\0'))) throw new Error('Worker arguments must not contain NUL bytes.');\n  for (const key of Object.keys(options.env ?? {})) {\n    if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) throw new Error(`Invalid worker environment variable name: ${key}`);\n  }\n  validateRelativePath(options.workingDirectory ?? '.', 'workingDirectory');\n  validateInput(options.input);\n  for (const [name, value] of [\n    ['inputLimitBytes', options.inputLimitBytes],\n    ['startupTimeoutMs', options.startupTimeoutMs],\n    ['executionTimeoutMs', options.executionTimeoutMs],\n    ['terminationGraceMs', options.terminationGraceMs],\n  ] as const) {\n    if (value !== undefined && (!Number.isFinite(value) || value <= 0))\n      throw new Error(`${name} must be greater than zero.`);\n  }\n  const resourceLimits = options.resourceLimits;\n  if (resourceLimits) {\n    const knownLimits = new Set(['cpuTimeSeconds', 'addressSpaceBytes', 'fileSizeBytes', 'openFiles']);\n    for (const name of Object.keys(resourceLimits)) {\n      if (!knownLimits.has(name)) throw new Error(`Unknown worker resource limit: ${name}.`);\n    }\n    for (const [name, value] of [\n      ['cpuTimeSeconds', resourceLimits.cpuTimeSeconds],\n      ['addressSpaceBytes', resourceLimits.addressSpaceBytes],\n      ['fileSizeBytes', resourceLimits.fileSizeBytes],\n      ['openFiles', resourceLimits.openFiles],\n    ] as const) {\n      if (value !== undefined && (!Number.isSafeInteger(value) || value <= 0)) {\n        throw new Error(`Worker resourceLimits.${name} must be a positive safe integer.`);\n      }\n    }\n  }","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/deployers/sandbox/src/worker.ts#L165-L201","documentation":"The optional numeric worker options inputLimitBytes, startupTimeoutMs, executionTimeoutMs, and terminationGraceMs must each be a finite number greater than zero when provided. This check runs inside validateOptions before any sandbox interaction, using the option name in the message.","triggerScenarios":"Passing any of these four options as 0, negative, NaN, or Infinity to deployWorkerToSandbox.","commonSituations":"Disabling a timeout by setting it to 0 (instead of omitting it); string values from env/config that were never converted (NaN); computing durations with buggy arithmetic producing negative or infinite values.","solutions":["Provide positive finite millisecond/byte values, or omit the option entirely (undefined is valid).","Guard each value: if (v !== undefined && (!Number.isFinite(v) || v <= 0)) fix the config source.","Fix parsing — coerce strings with Number() and validate Number.isFinite before constructing options."],"exampleFix":"// before\nawait deployWorkerToSandbox({ sandbox, command: 'node', startupTimeoutMs: 0 });\n// after\nawait deployWorkerToSandbox({ sandbox, command: 'node', startupTimeoutMs: 30000 });","handlingStrategy":"validation","validationCode":"const numericChecks = { inputLimitBytes: opts.inputLimitBytes, startupTimeoutMs: opts.startupTimeoutMs, executionTimeoutMs: opts.executionTimeoutMs, terminationGraceMs: opts.terminationGraceMs };\nfor (const [name, v] of Object.entries(numericChecks)) {\n  if (v !== undefined && (!Number.isFinite(v) || v <= 0)) throw new Error(`${name} must be a positive finite number`);\n}","typeGuard":"const isPositiveFinite = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v > 0;","tryCatchPattern":null,"preventionTips":["Omit options you don't need instead of passing 0/negatives","Coerce and validate any value sourced from env/JSON before building options","Centralize worker option construction in one validated factory function"],"tags":["worker","validation","configuration"],"backgroundTag":"invalid-option-value","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}