{"record":{"id":"80ac5ebd29202c1d","repo":"mastra-ai/mastra","slug":"relaunch-requires-a-new-executionid","errorCode":null,"errorMessage":"Relaunch requires a new executionId.","messagePattern":"Relaunch requires a new executionId\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deployers/sandbox/src/worker.ts","lineNumber":413,"sourceCode":"    cancel: () => cancelExecution(config, executionId, resolvePaths),\n    stop: async () => {\n      if (!config.sandbox.stop) throw new Error(`Sandbox provider \"${config.sandbox.provider}\" does not support stop.`);\n      await config.sandbox.stop();\n    },\n    destroy: options => destroyWithRetry(config.sandbox, options),\n  };\n}\n\nfunction deployment(\n  config: WorkerConfig,\n  executionId: string,\n  sandboxId: string,\n  expiresAt?: Date,\n): SandboxWorkerDeployment {\n  return {\n    ...execution(config, executionId, sandboxId, expiresAt),\n    relaunch: async options => {\n      if (options.executionId === executionId) throw new Error('Relaunch requires a new executionId.');\n      validateInput(options.input);\n      return createExecution(config, options.executionId, options.input);\n    },\n  };\n}\n\nasync function stageInput(\n  config: WorkerConfig,\n  paths: ReturnType<typeof executionPaths>,\n  input?: SandboxWorkerInput,\n): Promise<string | undefined> {\n  if (!input) return undefined;\n  const data = typeof input.data === 'string' ? Buffer.from(input.data) : Buffer.from(input.data);\n  if (data.byteLength > config.inputLimitBytes) {\n    throw new Error(`Worker input exceeds inputLimitBytes (${data.byteLength} > ${config.inputLimitBytes}).`);\n  }\n  const path = input.type === 'stdin' ? paths.stdin : posix.resolve(config.remoteDir, input.path);\n  await uploadFile(config.sandbox, path, data);","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/deployers/sandbox/src/worker.ts#L395-L431","documentation":"relaunch() on a worker deployment creates a brand-new execution, so the caller must supply a fresh executionId. Supplying the same executionId as the current deployment would collide with the existing execution's paths/state, so the library rejects it upfront.","triggerScenarios":"Calling deployment.relaunch({ executionId, input }) where options.executionId === the executionId the deployment was created with.","commonSituations":"Reusing a stored/derived executionId (e.g. from the original deploy record) when relaunching; retry loops that forget to generate a new id; copy-pasted relaunch options.","solutions":["Generate a new unique executionId (e.g. crypto.randomUUID()) for each relaunch call.","If you intended a retry of the same logical run, treat the new executionId as the retry's id — the library has no same-id retry path.","Check your persistence layer for stale execution ids being passed back on relaunch."],"exampleFix":"// before\nawait worker.relaunch({ executionId, input });\n// after\nawait worker.relaunch({ executionId: crypto.randomUUID(), input });","handlingStrategy":"validation","validationCode":"function assertNewExecutionId(currentId, nextId) {\n  if (!nextId || nextId === currentId) throw new Error('relaunch requires a fresh executionId');\n}","typeGuard":"function isFreshExecutionId(currentId, options) { return typeof options?.executionId === 'string' && options.executionId.length > 0 && options.executionId !== currentId; }","tryCatchPattern":"try {\n  await worker.relaunch({ executionId: newId, input });\n} catch (e) {\n  if (/Relaunch requires a new executionId/.test(e.message)) {\n    throw new Error('caller bug: reuse of executionId in relaunch');\n  } else throw e;\n}","preventionTips":["Always mint a new uuid for each relaunch; never pass the deployment's stored executionId.","Centralize executionId generation in one helper to avoid stale-id reuse.","Validate relaunch options in your application layer before invoking the library."],"tags":["sandbox","invalid-argument","relaunch","identifier"],"backgroundTag":"invalid-argument","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}