{"record":{"id":"366553e6ebfb549b","repo":"mastra-ai/mastra","slug":"sandbox-provider-config-sandbox-provider-does","errorCode":null,"errorMessage":"Sandbox provider \"${config.sandbox.provider}\" does not support stop.","messagePattern":"Sandbox provider \"(.+?)\" does not support stop\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deployers/sandbox/src/worker.ts","lineNumber":397,"sourceCode":"  return deployment(config, executionId, info?.id ?? config.sandbox.id ?? 'unknown', info?.timeoutAt);\n}\n\nfunction execution(\n  config: WorkerExecutionConfig,\n  executionId: string,\n  sandboxId: string,\n  expiresAt?: Date,\n): SandboxWorkerExecution {\n  const resolvePaths = async () => executionPaths(await config.resolveRemoteDir(), executionId);\n  return {\n    sandboxId,\n    executionId,\n    expiresAt,\n    status: options => readWorkerStatus(config.sandbox, executionId, resolvePaths, options),\n    readOutput: (stream, options) => readOutput(config.sandbox, executionId, resolvePaths, stream, options),\n    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);","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/deployers/sandbox/src/worker.ts#L379-L415","documentation":"The worker deployment exposes a stop() operation, but the underlying sandbox provider adapter does not implement the optional stop capability. The library throws immediately rather than attempting an unsupported provider call.","triggerScenarios":"Calling workerDeployment.stop() (e.g. from attachWorkerDeployment consumers) on a sandbox whose provider object has no stop function — checked via `if (!config.sandbox.stop)`.","commonSituations":"Using a sandbox provider that only supports destroy (hard teardown) but not graceful stop; custom or minimal provider implementations that omit the optional stop hook; swapping providers in config without updating lifecycle code that assumes stop exists.","solutions":["Check the provider capabilities before calling stop: `if (sandbox.stop) await sandbox.stop(); else await sandbox.destroy();`","Implement the optional `stop` method on your custom sandbox provider adapter if graceful stop is required.","Use destroy() instead of stop() if hard teardown is acceptable.","Switch to a sandbox provider that supports graceful stop if stop semantics are required."],"exampleFix":"// before\nawait worker.stop();\n// after\nif (workerStopSupported) { await worker.stop(); } else { await worker.destroy(); }","handlingStrategy":"type-guard","validationCode":"// guard before calling stop\nif (typeof sandbox.stop !== 'function') {\n  // fall back to destroy or surface capability limitation\n}","typeGuard":"function supportsStop(sandbox) { return typeof sandbox === 'object' && sandbox !== null && typeof sandbox.stop === 'function'; }","tryCatchPattern":"try {\n  await worker.stop();\n} catch (e) {\n  if (/does not support stop/.test(e.message)) {\n    await worker.destroy(); // graceful stop unavailable; hard teardown\n  } else throw e;\n}","preventionTips":["Document/feature-detect provider capabilities at startup and store them alongside config.","Prefer destroy() when your provider is known to lack stop.","When writing custom sandbox adapters, implement optional lifecycle hooks you plan to call.","Add an integration test asserting stop/destroy behavior per provider."],"tags":["sandbox","unsupported-operation","provider-capability","lifecycle"],"backgroundTag":"unsupported-operation","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}