{"record":{"id":"65872536bd8c10e8","repo":"mastra-ai/mastra","slug":"this-constructor-name-implements-neither-start","errorCode":null,"errorMessage":"${this.constructor.name} implements neither start() nor the create() acquisition primitive, so starting it would do nothing. Implement one using method syntax.","messagePattern":"(.+?) implements neither start\\(\\) nor the create\\(\\) acquisition primitive, so starting it would do nothing\\. Implement one using method syntax\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/workspace/sandbox/mastra-sandbox.ts","lineNumber":545,"sourceCode":"   *    decomposes into lookup/wake/provision.\n   * 2. Override `start()` returning {@link SandboxStartResult} — for\n   *    providers with a fused getOrCreate-style API where decomposition\n   *    would add round-trips.\n   * 3. Override `start()` returning void — the outcome is unknown.\n   *\n   * The base constructor wraps `start()` so direct calls are routed through\n   * `_start()`. Use METHOD syntax when overriding — a class-field `start`\n   * initializer would overwrite the wrapper. Implementing neither rung throws:\n   * a sandbox with nothing to start says so with an empty `async start() {}`.\n   *\n   * Id-keyed getOrCreate contract: a sandbox constructed with a known `id`\n   * resolves that id on start — reconnect/resume when the provider finds an\n   * existing VM for it, create otherwise.\n   */\n  async start(): Promise<SandboxStartResult | void> {\n    // Also where a misspelled override and a class-FIELD `start`/`create` land,\n    // since field initializers run too late for the constructor to see them.\n    throw new Error(\n      `${this.constructor.name} implements neither start() nor the create() acquisition primitive, so starting it would do nothing. Implement one using method syntax.`,\n    );\n  }\n\n  /**\n   * Ensure the sandbox is running.\n   *\n   * Calls `_start()` if status is not 'running'. Useful for lazy initialization\n   * where operations should automatically start the sandbox if needed.\n   *\n   * This is the lazy entry point into the id-keyed getOrCreate contract\n   * described on {@link start}.\n   *\n   * @throws {SandboxNotReadyError} if the sandbox fails to reach 'running' status\n   *\n   * @example\n   * ```typescript\n   * async executeCommand(command: string): Promise<CommandResult> {","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workspace/sandbox/mastra-sandbox.ts#L527-L563","documentation":"The default start() on MastraSandbox throws when a subclass implements neither start() nor the create() acquisition primitive. Starting such a sandbox would be a no-op, so the library fails immediately with guidance to use method syntax (class-field definitions are invisible to the constructor's validation).","triggerScenarios":"Calling start() on a sandbox subclass that only defines helper methods, or that declared start/create as class-field arrow functions, or misspelled the override (e.g. `onStart`/`creat` instead of `create`).","commonSituations":"Writing a minimal custom sandbox provider and forgetting the acquisition primitive; converting methods to arrow-function fields during a refactor; copying a subclass and deleting create() while leaving call sites.","solutions":["Implement `async create()` (and optionally `find()`/`connect()`) using method syntax on your subclass.","Or override `async start()` itself with method syntax if your provider has custom acquisition logic.","Move any class-field arrow function definitions of start/create/connect/find to regular methods."],"exampleFix":"// before\nclass MySandbox extends MastraSandbox {\n  create = async () => { this.handle = await provider.launch(); };\n}\n// after\nclass MySandbox extends MastraSandbox {\n  async create() { this.handle = await provider.launch(); }\n}","handlingStrategy":"validation","validationCode":"const proto = MySandbox.prototype as any;\nif (typeof proto.start !== 'function' ||\n    (proto.start === MastraSandbox.prototype.start && typeof proto.create !== 'function')) {\n  throw new Error('MySandbox must implement start() or create() using method syntax');\n}","typeGuard":"function isStartable(sb: object): boolean {\n  const p = sb.constructor?.prototype ?? sb;\n  return typeof (p as any).create === 'function' || typeof (p as any).start === 'function';\n}","tryCatchPattern":"try {\n  await sandbox.start();\n} catch (e) {\n  if (e instanceof Error && /implements neither start\\(\\) nor/.test(e.message)) {\n    throw new Error(`Misconfigured sandbox subclass ${sandbox.constructor.name}`, { cause: e });\n  }\n  throw e;\n}","preventionTips":["Implement create() (or start()) with regular method syntax in every sandbox subclass.","Never define start/create as class-field arrow functions — the constructor cannot see them.","Grep your subclass for misspelled lifecycle method names before shipping.","Smoke-test each sandbox subclass's start() in CI."],"tags":["sandbox","subclassing","api-misuse"],"backgroundTag":"unimplemented-abstract-method","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}