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

shutdown_gate_blocked:pending=${gate.pending},blocked=${gate

Error message

shutdown_gate_blocked:pending=${gate.pending},blocked=${gate.blocked},in_progress=${gate.in_progress},failed=${gate.failed}

What it means

Shutdown gate refusal: the gate is not allowed and issue confirmation is not the reason, so the message reports counts of pending, blocked, in_progress and failed tasks. Shutdown is blocked while work is still in flight.

Source

Thrown at src/team/runtime.ts:4941

  );

  const classification = await withTeamTaskMembershipBarrier(sanitized, cwd, async () => {
    const current = await classifyShutdown({
      teamName: sanitized,
      cwd,
      config: config!,
      governance,
      confirmIssues,
    });
    const { gate, requiresIssueConfirmation } = current;

    if (!force && !gate.allowed) {
      if (requiresIssueConfirmation) {
        throw new Error(
          `shutdown_confirm_issues_required:failed=${gate.failed}:rerun=omx team shutdown ${sanitized} --confirm-issues`,
        );
      }
      throw new Error(
        `shutdown_gate_blocked:pending=${gate.pending},blocked=${gate.blocked},in_progress=${gate.in_progress},failed=${gate.failed}`,
      );
    }

    const now = new Date().toISOString();
    const existingPhase = await readTeamPhaseState(sanitized, cwd);
    const terminalReason = force ? 'forced_shutdown' : 'shutdown_gate_passed';
    await writeTeamPhaseState(sanitized, {
      current_phase: existingPhase?.current_phase ?? 'team-exec',
      max_fix_attempts: existingPhase?.max_fix_attempts ?? 3,
      current_fix_attempt: existingPhase?.current_fix_attempt ?? 0,
      transitions: existingPhase?.transitions ?? [],
      updated_at: now,
      terminal_epoch: existingPhase?.terminal_epoch ?? now,
      terminal_reason: existingPhase?.terminal_reason ?? terminalReason,
      final_task_counts: {
        total: gate.total,
        pending: gate.pending,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Wait for or drive the listed in_progress/pending tasks to completion, unblock or cancel blocked tasks, then retry shutdown
  2. Cancel/abandon tasks that no longer matter so the gate counts drop to zero
  3. If deliberate, use the force shutdown option (with the caveat that in-flight work is destroyed)

Example fix

# before
omx team shutdown myteam
# error: pending=3,blocked=1,in_progress=2,failed=0

# after
omx team task wait myteam --all   # drain work first
omx team shutdown myteam
Defensive patterns

Strategy: validation

Validate before calling

const { gate } = await evaluateShutdownGate(teamName, {});
if (!gate.allowed) throw new Error(`pending=${gate.pending} in_progress=${gate.in_progress}`);

Try / catch

try { await shutdownTeam(t, cwd, {}); } catch (e) { if (/^shutdown_gate_blocked:/.test((e as Error).message)) { await drainTasks(t); await shutdownTeam(t, cwd, {}); } else throw e; }

Prevention

When it happens

Trigger: Calling shutdown without force while tasks are still pending, blocked, in_progress (or failed); the embedded counts tell you which categories are holding the gate.

Common situations: Shutting down a busy team; long-running tasks not yet finished; blocked tasks stuck on dependencies that were never resolved.

Related errors


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