{"record":{"id":"d6e8ac4fae86f5c7","repo":"Yeachan-Heo/oh-my-codex","slug":"tmux-pane-team-owner-changed-target","errorCode":null,"errorMessage":"tmux pane team owner changed: ${target}","messagePattern":"tmux pane team owner changed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/tmux-session.ts","lineNumber":314,"sourceCode":"  const [sessionName, sessionId, sessionCreated, windowIndex, windowId, capturedPaneId, panePid] = fields;\n  if (!sessionName || !/^\\$[0-9]+$/.test(sessionId) || !/^[0-9]+$/.test(sessionCreated)\n    || !/^[0-9]+$/.test(windowIndex) || !/^@[0-9]+$/.test(windowId)\n    || capturedPaneId !== target || !/^[1-9][0-9]*$/.test(panePid)) {\n    throw new Error('malformed tmux source authority');\n  }\n  const parsedPid = Number(panePid);\n  if (!Number.isSafeInteger(parsedPid) || parsedPid <= 0) throw new Error('malformed tmux source authority');\n  const proof = readExactPaneProofSync(target);\n  if (proof.status === 'unavailable') throw new ExactPaneProofUnavailableError(proof);\n  if (proof.status !== 'live' || proof.pid !== parsedPid) throw new Error(`tmux pane identity changed: ${target}`);\n  const ownerResult = runTmuxStructured(['show-option', '-qv', '-p', '-t', target, OMX_TEAM_PANE_OWNER_OPTION]);\n  if (!ownerResult.ok) throw new Error(`failed to capture tmux pane owner: ${ownerResult.stderr}`);\n  const teamPaneOwnerId = ownerResult.stdout.trim() || null;\n  if (teamPaneOwnerId && !/^[A-Za-z0-9._:-]+$/.test(teamPaneOwnerId)) {\n    throw new Error('malformed tmux pane owner');\n  }\n  if (expectedTeamPaneOwnerId !== undefined && teamPaneOwnerId !== expectedTeamPaneOwnerId) {\n    throw new Error(`tmux pane team owner changed: ${target}`);\n  }\n  return {\n    paneId: target,\n    panePid: parsedPid,\n    sessionName,\n    sessionId,\n    sessionCreated,\n    windowId,\n    windowIndex,\n    teamPaneOwnerId,\n  };\n}\n\nfunction sourceAuthorityPredicate(source: SourcePaneAuthority): string {\n  return [\n    '#{==:#{pane_dead},0}',\n    `#{==:#{pane_id},${source.paneId}}`,\n    `#{==:#{pane_pid},${source.panePid}}`,","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/tmux-session.ts#L296-L332","documentation":"The pane's @omx_team_pane_owner_id differs from the expected owner token passed by the caller. The owner token scopes panes to one team session; a mismatch means the pane was re-registered to another team (or a new team incarnation), so this session must not treat it as its own.","triggerScenarios":"Calling captureSourcePaneAuthority(paneId, expectedOwnerId) where the pane's stored owner id was overwritten by another createTeamSession run, a team re-attach created a new owner token, or the option was manually changed.","commonSituations":"Two team sessions target the same pane; a previous session's cleanup re-tagged the pane; recovery/reattach logic regenerated the owner token while stale callers still expect the old one.","solutions":["Re-discover which team session currently owns the pane (`tmux show-option -qv -p -t <pane> @omx_team_pane_owner_id`) and use that token","Ensure only one team-session lifecycle runs against a given pane at a time","Clear the stale owner option on orphaned panes before re-creating a session"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const owner = runTmuxStructured(['show-option','-qv','-p','-t',paneId,'@omx_team_pane_owner_id']).stdout?.trim();\nif (owner && owner !== expectedOwnerId) rebindOwner();","typeGuard":null,"tryCatchPattern":"catch (e) { if (/team owner changed/.test(e.message)) { adoptCurrentOwner(); return; } throw e; }","preventionTips":["Run one team session per pane; enforce single-writer ownership","On re-attach, re-read the owner token instead of assuming the old one"],"tags":["tmux","ownership","session-state"],"backgroundTag":"resource-ownership-mismatch","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}