{"record":{"id":"ef2febaf23953424","repo":"mastra-ai/mastra","slug":"sandbox-provider-options-sandbox-provider-doe","errorCode":null,"errorMessage":"Sandbox provider \"${options.sandbox.provider}\" does not support executeCommand, which is required for worker deploys.","messagePattern":"Sandbox provider \"(.+?)\" does not support executeCommand, which is required for worker deploys\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deployers/sandbox/src/worker.ts","lineNumber":138,"sourceCode":"        allowFailure: true,\n        label: 'release worker artifact lock',\n      });\n    }\n  }\n\n  try {\n    await installDependencies(sandbox, remoteDir, installHash ?? undefined, installCommand, options.installTimeoutMs);\n  } catch (error) {\n    throw workerPhaseError('install', error);\n  }\n\n  return createExecution(config, executionId, options.input);\n}\n\n/** Reattach to a persisted worker execution without its original launch configuration. */\nexport async function attachWorkerDeployment(options: AttachWorkerDeploymentOptions): Promise<SandboxWorkerExecution> {\n  if (!options.sandbox.executeCommand) {\n    throw new Error(\n      `Sandbox provider \"${options.sandbox.provider}\" does not support executeCommand, which is required for worker deploys.`,\n    );\n  }\n  validateExecutionId(options.executionId);\n  if (\n    options.terminationGraceMs !== undefined &&\n    (!Number.isFinite(options.terminationGraceMs) || options.terminationGraceMs <= 0)\n  ) {\n    throw new Error('terminationGraceMs must be greater than zero.');\n  }\n\n  let remoteDir: string | undefined;\n  const config: WorkerExecutionConfig = {\n    sandbox: options.sandbox,\n    resolveRemoteDir: async () => (remoteDir ??= await resolveRemoteDir(options.sandbox, options.remoteDir)),\n    terminationGraceMs: options.terminationGraceMs ?? 5_000,\n  };\n  const info = await getInfoSafe(options.sandbox);","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/deployers/sandbox/src/worker.ts#L120-L156","documentation":"attachWorkerDeployment reattaches to a persisted worker execution and needs to issue commands (e.g. to resolve the remote dir and inspect the process). Like runInSandbox, it requires the provider to implement executeCommand and fails fast with the provider name otherwise.","triggerScenarios":"Calling attachWorkerDeployment({ sandbox, executionId, ... }) where options.sandbox.executeCommand is undefined.","commonSituations":"Reattaching after a process restart using a reconstructed/persisted sandbox descriptor that lacks the executeCommand closure; custom providers without exec support.","solutions":["Reconstruct the sandbox object with a working executeCommand implementation before reattaching.","Switch to a provider that supports executeCommand.","If only metadata is needed, use a provider API that fetches execution status instead of reattaching via commands."],"exampleFix":"// before\nawait attachWorkerDeployment({ sandbox: storedSandbox, executionId });\n// after\nconst sandbox = await createProviderSandbox({ id: storedSandbox.id }); // provider with executeCommand\nawait attachWorkerDeployment({ sandbox, executionId });","handlingStrategy":"validation","validationCode":"if (typeof sandbox.executeCommand !== 'function') throw new Error('Cannot reattach: sandbox provider lacks executeCommand');","typeGuard":"function canAttach(s: WorkspaceSandbox): s is WorkspaceSandbox & Required<Pick<WorkspaceSandbox, 'executeCommand'>> {\n  return typeof s.executeCommand === 'function';\n}","tryCatchPattern":null,"preventionTips":["Persist the provider id/config, not the live object; rebuild with methods on reattach","Verify exec support before persisting executions","Use providers that support process reattachment"],"tags":["sandbox","worker","capability"],"backgroundTag":"sandbox-execute-command-unsupported","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}