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

shutdown_shared_session_worker_owner_unavailable:${paneId}:$

Error message

shutdown_shared_session_worker_owner_unavailable:${paneId}:${owner.error}

What it means

During shared-session shutdown, the runtime reads the team-owner tag of a pane that topology independently identifies as a canonical worker. The read failed (owner.status === 'error'), so authority for that worker pane cannot be established and shutdown aborts rather than risk killing a pane owned by someone else.

Source

Thrown at src/team/runtime.ts:611

  authorizedTaggedWorkerPaneIds?: Set<string>,
): string[] {
  const expectedOwnerId = teamPaneOwnerId.trim();
  if (!expectedOwnerId && paneIds.length > 0) {
    throw new Error('shutdown_shared_session_worker_owner_unavailable:missing_team_owner_id');
  }

  const authorized = new Set<string>();
  for (const paneId of paneIds) {
    const owner = readPaneTeamOwnerTagResult(paneId);
    if (initiallyTaggedWorkerPaneIds?.has(paneId)
      && (owner.status !== 'value' || owner.value !== expectedOwnerId)) {
      throw new Error(`shutdown_shared_session_worker_owner_changed:${paneId}`);
    }
    if (owner.status === 'error') {
      // A read failure is authority ambiguity only for an explicit persisted
      // worker that topology independently identifies as a worker candidate.
      if (canonicalWorkerPaneIds.has(paneId)) {
        throw new Error(`shutdown_shared_session_worker_owner_unavailable:${paneId}:${owner.error}`);
      }
      continue;
    }
    if (owner.status === 'value') {
      if (owner.value === expectedOwnerId) {
        authorized.add(paneId);
        authorizedTaggedWorkerPaneIds?.add(paneId);
      } else if (canonicalWorkerPaneIds.has(paneId)) {
        throw new Error(`shutdown_shared_session_worker_owner_changed:${paneId}`);
      }
      continue;
    }
    if (canonicalWorkerPaneIds.has(paneId)) {
      throw new Error(`shutdown_shared_session_worker_owner_changed:${paneId}`);
    }
  }
  return [...authorized];
}

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Retry the shutdown once tmux settles; transient read failures are the most common cause.
  2. Verify tmux server health and that the pane still exists (tmux list-panes -a).
  3. Check tmux version supports the user-attribute API this library relies on.
  4. Inspect for concurrent processes removing/retagging panes during shutdown.

Example fix

// before
const panes = await collectAuthorizedSharedSessionWorkerPaneIds(...);

// after
let panes;
try {
  panes = await collectAuthorizedSharedSessionWorkerPaneIds(...);
} catch (e) {
  if (String(e.message).startsWith('shutdown_shared_session_worker_owner_unavailable:')) {
    await sleep(500); // let tmux settle, then retry once
    panes = await collectAuthorizedSharedSessionWorkerPaneIds(...);
  } else throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

const exists = await paneExists(paneId); // tmux list-panes check
if (!exists) skipPane(paneId);

Type guard

function isOwnerUnavailableError(e: unknown, paneId?: string): e is Error {
  return e instanceof Error && e.message.startsWith('shutdown_shared_session_worker_owner_unavailable:') && (!paneId || e.message.includes(`:${paneId}:`));
}

Try / catch

try { await shutdownSharedSession(...); } catch (e) { if (isOwnerUnavailableError(e)) { await delay(500); return shutdownSharedSession(...); } throw e; }

Prevention

When it happens

Trigger: Calling shutdown/converge paths that invoke collectAuthorizedSharedSessionWorkerPaneIds while a tmux user-attribute read (pane owner tag) errors for a pane present in canonicalWorkerPaneIds.

Common situations: tmux server hiccup or version/feature gap breaking show-options/user-attribute reads, pane destroyed mid-shutdown, or permissions issues on the tmux socket.

Related errors


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