{"record":{"id":"9ea2009d6401868f","repo":"thedotmack/claude-mem","slug":"supervisor-is-shutting-down-refusing-to-spawn-t","errorCode":null,"errorMessage":"Supervisor is shutting down, refusing to spawn ${type}","messagePattern":"Supervisor is shutting down, refusing to spawn (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/supervisor/index.ts","lineNumber":124,"sourceCode":"      await this.stopPromise;\n      return;\n    }\n\n    stopHealthChecker();\n    this.stopPromise = runShutdownCascade({\n      registry: this.registry,\n      currentPid: process.pid\n    }).finally(() => {\n      this.started = false;\n      this.stopPromise = null;\n    });\n\n    await this.stopPromise;\n  }\n\n  assertCanSpawn(type: string): void {\n    if (this.stopPromise !== null) {\n      throw new Error(`Supervisor is shutting down, refusing to spawn ${type}`);\n    }\n  }\n\n  registerProcess(id: string, processInfo: ManagedProcessInfo, processRef?: Parameters<ProcessRegistry['register']>[2]): void {\n    this.registry.register(id, processInfo, processRef);\n  }\n\n  unregisterProcess(id: string): void {\n    this.registry.unregister(id);\n  }\n\n  getRegistry(): ProcessRegistry {\n    return this.registry;\n  }\n}\n\nconst supervisorSingleton = new Supervisor(getProcessRegistry());\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/supervisor/index.ts#L106-L142","documentation":"Error \"Supervisor is shutting down, refusing to spawn ${type}\" thrown in thedotmack/claude-mem.","triggerScenarios":"Fires when a spawn request (worker, SDK subprocess, or other managed process) arrives after the supervisor has begun shutdown, e.g. during Ctrl-C handling, an in-flight session finalization, or a restart race. The guard at src/supervisor/index.ts:124 refuses the spawn so no orphan process outlives the supervisor.","commonSituations":"See trigger scenarios.","solutions":["Do not spawn new processes after shutdown begins; wait for the supervisor to finish stopping, then start a new supervisor.","If this fires unexpectedly, check what triggered shutdown (signal handler or stop()) and reorder the spawn to occur before stop."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}