{"record":{"id":"c23026827c2a64f8","repo":"Yeachan-Heo/oh-my-codex","slug":"shutdown-prompt-teardown-failed-promptteardownfa","errorCode":null,"errorMessage":"shutdown_prompt_teardown_failed:${promptTeardownFailures.join(',')}","messagePattern":"shutdown_prompt_teardown_failed:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/runtime.ts","lineNumber":5506,"sourceCode":"    if (!sessionName.includes(':')) {\n      await destroyConfiguredDetachedTeamSession(sanitized, cwd, config);\n    }\n  } else {\n    const promptTeardownFailures: string[] = [];\n    for (const w of config.workers) {\n      const teardown = await teardownPromptWorker(\n        sanitized,\n        w.name,\n        w.pid as number | undefined,\n        cwd,\n        'shutdown',\n      );\n      if (!teardown.terminated) {\n        promptTeardownFailures.push(`${w.name}:${teardown.error || 'unknown_error'}`);\n      }\n    }\n    if (promptTeardownFailures.length > 0) {\n      throw new Error(`shutdown_prompt_teardown_failed:${promptTeardownFailures.join(',')}`);\n    }\n  }\n\n  const shutdownReports = await prepareWorkerWorktreeShutdownReports(config, cwd);\n\n  const commitHygieneEntries: TeamOperationalCommitEntry[] = [];\n  for (const report of shutdownReports) {\n    const worker = config.workers.find((entry) => entry.name === report.workerName);\n    if (report.syntheticCommit) {\n      commitHygieneEntries.push({\n        recorded_at: new Date().toISOString(),\n        operation: 'shutdown_checkpoint',\n        worker_name: report.workerName,\n        task_id: worker?.assigned_tasks[0],\n        status: 'applied',\n        operational_commit: report.syntheticCommit,\n        source_commit: report.sourceRef,\n        worktree_path: report.worktreePath,","sourceCodeStart":5488,"sourceCodeEnd":5524,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L5488-L5524","documentation":"Thrown during team shutdown when one or more prompt-mode workers failed to terminate cleanly. The error lists each failed worker as name:error pairs so you can see which worker survived teardown and why.","triggerScenarios":"Calling the team shutdown API with worker_launch_mode='prompt'; teardown of a worker returns terminated=false (e.g. process already dead, kill signal failed, or an unknown teardown error).","commonSituations":"Workers whose prompt process crashed or exited before shutdown, stale pane/process IDs in team config, or kill permission issues on the host.","solutions":["Check the worker names in the message; verify whether their prompt processes still exist (ps / tmux list-panes)","Manually kill leftover worker processes or panes, then rerun shutdown","Inspect teardown.error for the root cause (e.g. ESRCH, EPERM)","If recurring, delete the team state dir so shutdown has no stale worker entries"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const alive = config.workers.filter(w => isPromptWorkerAlive(config, w)); if (alive.length === 0) skip shutdown prompt teardown;","typeGuard":null,"tryCatchPattern":"try { await shutdownTeam(...); } catch (e) { if (String(e.message).startsWith('shutdown_prompt_teardown_failed:')) { /* parse name:err pairs, kill stragglers, retry once */ } else throw e; }","preventionTips":["Check worker liveness before initiating shutdown","Ensure workers are stopped gracefully before killing panes","Run shutdown from the same cwd the team was created in"],"tags":["team","shutdown","prompt-worker","process-termination"],"backgroundTag":"process-termination-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}