Yeachan-Heo/oh-my-codex · error · Error

shutdown_prompt_teardown_failed:${promptTeardownFailures.joi

Error message

shutdown_prompt_teardown_failed:${promptTeardownFailures.join(',')}

What it means

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.

Source

Thrown at src/team/runtime.ts:5506

    if (!sessionName.includes(':')) {
      await destroyConfiguredDetachedTeamSession(sanitized, cwd, config);
    }
  } else {
    const promptTeardownFailures: string[] = [];
    for (const w of config.workers) {
      const teardown = await teardownPromptWorker(
        sanitized,
        w.name,
        w.pid as number | undefined,
        cwd,
        'shutdown',
      );
      if (!teardown.terminated) {
        promptTeardownFailures.push(`${w.name}:${teardown.error || 'unknown_error'}`);
      }
    }
    if (promptTeardownFailures.length > 0) {
      throw new Error(`shutdown_prompt_teardown_failed:${promptTeardownFailures.join(',')}`);
    }
  }

  const shutdownReports = await prepareWorkerWorktreeShutdownReports(config, cwd);

  const commitHygieneEntries: TeamOperationalCommitEntry[] = [];
  for (const report of shutdownReports) {
    const worker = config.workers.find((entry) => entry.name === report.workerName);
    if (report.syntheticCommit) {
      commitHygieneEntries.push({
        recorded_at: new Date().toISOString(),
        operation: 'shutdown_checkpoint',
        worker_name: report.workerName,
        task_id: worker?.assigned_tasks[0],
        status: 'applied',
        operational_commit: report.syntheticCommit,
        source_commit: report.sourceRef,
        worktree_path: report.worktreePath,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Check the worker names in the message; verify whether their prompt processes still exist (ps / tmux list-panes)
  2. Manually kill leftover worker processes or panes, then rerun shutdown
  3. Inspect teardown.error for the root cause (e.g. ESRCH, EPERM)
  4. If recurring, delete the team state dir so shutdown has no stale worker entries
Defensive patterns

Strategy: try-catch

Validate before calling

const alive = config.workers.filter(w => isPromptWorkerAlive(config, w)); if (alive.length === 0) skip shutdown prompt teardown;

Try / catch

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; }

Prevention

When it happens

Trigger: 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).

Common situations: Workers whose prompt process crashed or exited before shutdown, stale pane/process IDs in team config, or kill permission issues on the host.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/c23026827c2a64f8. Report an issue: GitHub.