{"record":{"id":"c734740ce77a2f18","repo":"mastra-ai/mastra","slug":"unknown-worker-resource-limit-name","errorCode":null,"errorMessage":"Unknown worker resource limit: ${name}.","messagePattern":"Unknown worker resource limit: (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deployers/sandbox/src/worker.ts","lineNumber":189,"sourceCode":"  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  }\n}\n\nfunction validateRelativePath(value: string, label: string): void {\n  if (!value || posix.isAbsolute(value) || posix.normalize(value).startsWith('..')) {\n    throw new Error(`Worker ${label} must stay within the deployed artifact root.`);\n  }","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/deployers/sandbox/src/worker.ts#L171-L207","documentation":"deployWorkerToSandbox's validateOptions whitelists exactly four worker resource limit keys: cpuTimeSeconds, addressSpaceBytes, fileSizeBytes, and openFiles. If you pass options.resourceLimits containing any other key name, deployment aborts before anything is uploaded. This exists so typos and unsupported limit names fail fast instead of being silently ignored at deploy time.","triggerScenarios":"Passing options.resourceLimits with a key not in {cpuTimeSeconds, addressSpaceBytes, fileSizeBytes, openFiles} to deployWorkerToSandbox — e.g. resourceLimits: { memoryBytes: 134217728 } or { cpu: 2 } or a misspelled cpuTimeSecs. Note addressSpaceKilobytes/fileSizeBlocks are internal normalized fields and are NOT accepted in user options.","commonSituations":"Typos like cpuTime or openFile; guessing limit names from ulimit flags (-v, -n); copying limit names from another sandbox/worker library; trying to set a memory limit via memoryBytes instead of addressSpaceBytes; upgrading code that used an older or hypothetical API shape.","solutions":["Rename the offending key to one of the four supported limits: cpuTimeSeconds, addressSpaceBytes, fileSizeBytes, openFiles.","Use addressSpaceBytes for memory-style limits (it is converted to KB for ulimit -v internally).","Type the options object as DeployWorkerToSandboxOptions so TypeScript rejects unknown resourceLimits keys at compile time.","If you need a limit the library does not support, drop that key or file an upstream request; unsupported limits cannot be passed through."],"exampleFix":"// before\nawait deployWorkerToSandbox({\n  sandbox,\n  command: 'node',\n  resourceLimits: { memoryBytes: 256 * 1024 * 1024, cpuTimeSecs: 30 },\n});\n// after\nawait deployWorkerToSandbox({\n  sandbox,\n  command: 'node',\n  resourceLimits: { addressSpaceBytes: 256 * 1024 * 1024, cpuTimeSeconds: 30 },\n});","handlingStrategy":"validation","validationCode":"const KNOWN_LIMITS = new Set(['cpuTimeSeconds', 'addressSpaceBytes', 'fileSizeBytes', 'openFiles']);\nfunction assertKnownLimits(limits) {\n  for (const key of Object.keys(limits ?? {})) {\n    if (!KNOWN_LIMITS.has(key)) throw new Error(`Unsupported resource limit key: ${key}`);\n  }\n}\nassertKnownLimits(options.resourceLimits); // call before deployWorkerToSandbox","typeGuard":"function isResourceLimits(v) {\n  const known = ['cpuTimeSeconds', 'addressSpaceBytes', 'fileSizeBytes', 'openFiles'];\n  return typeof v === 'object' && v !== null && Object.keys(v).every(k => known.includes(k));\n}","tryCatchPattern":"try {\n  await deployWorkerToSandbox(options);\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith('Unknown worker resource limit:')) {\n    const badKey = error.message.match(/limit: (.+)\\./)?.[1];\n    console.error(`Remove or rename resourceLimits.${badKey}; supported keys: cpuTimeSeconds, addressSpaceBytes, fileSizeBytes, openFiles`);\n  } else throw error;\n}","preventionTips":["Type options as DeployWorkerToSandboxOptions and let excess property checks catch unknown keys at compile time.","Keep a single shared constants object for limit names instead of typing them inline in configs.","Write a unit test that validates every resourceLimits object your app constructs against the known key set."],"tags":["validation","configuration","worker","sandbox"],"backgroundTag":"invalid-option-key","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}