{"record":{"id":"e83c48056d7a5499","repo":"Yeachan-Heo/oh-my-codex","slug":"shutdown-shared-session-kind-replaceall","errorCode":null,"errorMessage":"shutdown_shared_session_${kind.replaceAll(' ', '_')}_proof_unavailable:${paneId}","messagePattern":"shutdown_shared_session_(.+?)_proof_unavailable:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/runtime.ts","lineNumber":5179,"sourceCode":"        leaderPaneId: effectiveLeaderPaneId,\n        hudPaneId: effectiveHudPaneId,\n      });\n    const canonicalWorkerPaneIds = [...shutdownPaneIds];\n    const expectedSharedWorkerPanePids = new Map<string, number>();\n    const prekillResolvedWorkerPaneIds = new Set<string>();\n    type FrozenSharedPaneAuthorization = {\n      paneId: string;\n      pid: number;\n      owner: string | null;\n    };\n    const freezeSharedPaneAuthorization = (\n      paneId: string,\n      kind: 'HUD pane' | 'restore leader pane',\n      expectedPid?: number | null,\n    ): FrozenSharedPaneAuthorization => {\n      const proof = readExactPaneProofSync(paneId);\n      if (proof.status !== 'live') {\n        throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_proof_unavailable:${paneId}`);\n      }\n      if (typeof expectedPid === 'number') {\n        if (!Number.isSafeInteger(expectedPid) || expectedPid <= 0) {\n          throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_pid_missing:${paneId}`);\n        }\n        if (proof.pid !== expectedPid) {\n          throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_identity_changed:${paneId}`);\n        }\n      }\n      const owner = readPaneTeamOwnerTagResult(paneId);\n      if (owner.status === 'error') {\n        throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_owner_unavailable:${paneId}:${owner.error}`);\n      }\n      if (owner.status !== 'value' || !tmuxPaneOwnerId || owner.value !== tmuxPaneOwnerId) {\n        throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_owner_changed:${paneId}`);\n      }\n      return { paneId, pid: proof.pid, owner: owner.value };\n    };","sourceCodeStart":5161,"sourceCodeEnd":5197,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L5161-L5197","documentation":"Thrown during shared-session shutdown when the code cannot read a 'live' proof for a pane (HUD pane or restore leader pane). The pane liveness proof (read via readExactPaneProofSync) either does not exist, is stale, or the pane has already died, so authorization cannot be frozen for shutdown.","triggerScenarios":"Calling the shutdown flow for a shared session where freezeSharedPaneAuthorization runs and readExactPaneProofSync(paneId) returns a status other than 'live' — e.g. the tmux pane %id was reused, closed, or its proof file was cleared before shutdown.","commonSituations":"The HUD/restore-leader pane was closed manually before shutdown; tmux session was killed out-of-band; stale hud_pane_id/leaderPaneId in persisted config pointing at a dead pane; pane id reuse by tmux.","solutions":["Verify the pane still exists with tmux list-panes -a -F '#{pane_id}' before initiating shutdown","Clear stale persisted pane ids (hud_pane_id / leader pane id) from the config so shutdown does not target dead panes","Retry shutdown after restarting the HUD pane or the team session","Check readExactPaneProofSync implementation for proof-file paths and ensure the proof file was not deleted"],"exampleFix":"// before\nawait shutdownSharedSession({ hudPaneId: staleConfig.hud_pane_id });\n// after\nconst livePaneIds = new Set(execSync(\"tmux list-panes -a -F '#{pane_id}'\").toString().trim().split('\\n'));\nawait shutdownSharedSession({ hudPaneId: livePaneIds.has(staleConfig.hud_pane_id) ? staleConfig.hud_pane_id : undefined });","handlingStrategy":"validation","validationCode":"const paneExists = (paneId) => { try { execSync(`tmux display-message -p -t ${paneId} '#{pane_id}'`, {stdio:'pipe'}); return true; } catch { return false; }; };","typeGuard":"const isPaneId = (v) => typeof v === 'string' && /^%[0-9]+$/.test(v);","tryCatchPattern":"try { await shutdown(env); } catch (e) { if (String(e.message).includes('_proof_unavailable:')) { /* clear persisted pane ids and retry once */ } else throw e; }","preventionTips":["Validate pane ids exist in tmux before shutdown","Clear persisted hud/leader pane ids whenever the session is recreated","Do not delete proof files manually"],"tags":["tmux","pane-lifecycle","shutdown","stale-state"],"backgroundTag":"stale-resource-id","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}