Yeachan-Heo/oh-my-codex · error · Error
invalid detached leader authority target
Error message
invalid detached leader authority target
What it means
captureDetachedLeaderAuthority validates its inputs before querying tmux: leaderPaneId must match tmux pane id format `%<digits>` and ownerId must be non-empty. Malformed args indicate caller corruption or bad upstream data.
Source
Thrown at src/cli/index.ts:1510
sessionName: string;
sessionId: string;
sessionCreated: string;
windowId: string;
windowIndex: string;
ownerId: string;
};
type DetachedHudAuthority = {
paneId: string;
panePid: number;
sessionId: string;
sessionCreated?: string;
windowId: string;
operationMarker: string;
};
function captureDetachedLeaderAuthority(leaderPaneId: string, expectedSessionName: string, ownerId: string): DetachedLeaderAuthority {
if (!/^%[0-9]+$/.test(leaderPaneId) || !ownerId) throw new Error("invalid detached leader authority target");
const output = execTmuxFileSync([
"display-message", "-p", "-t", leaderPaneId,
"#{session_name}\t#{session_id}\t#{session_created}\t#{window_index}\t#{window_id}\t#{pane_id}\t#{pane_pid}",
], { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
const fields = output.split("\t");
if (fields.length !== 7) throw new Error("malformed detached leader authority");
const [sessionName, sessionId, sessionCreated, windowIndex, windowId, paneId, panePid] = fields;
if (sessionName !== expectedSessionName || paneId !== leaderPaneId || !/^\$[0-9]+$/.test(sessionId)
|| !/^[0-9]+$/.test(sessionCreated) || !/^[0-9]+$/.test(windowIndex)
|| !/^@[0-9]+$/.test(windowId) || !/^[1-9][0-9]*$/.test(panePid)) {
throw new Error("malformed detached leader authority");
}
const parsedPid = Number(panePid);
if (!Number.isSafeInteger(parsedPid) || parsedPid <= 0) throw new Error("malformed detached leader authority");
return { paneId, panePid: parsedPid, sessionName, sessionId, sessionCreated, windowId, windowIndex, ownerId };
}
/** Internal detached-launch seam. Exported solely for deterministic CLI tests. */View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Pass the pane id exactly as tmux reports it (%0, %1, ...)
- Ensure ownerId is a non-empty session/owner identifier
- Log inputs upstream to find where the malformed id originates
Example fix
// before
captureDetachedLeaderAuthority("3", sessionName, "");
// after
captureDetachedLeaderAuthority("%3", sessionName, ownerId); Defensive patterns
Strategy: type-guard
Validate before calling
if (!/^%[0-9]+$/.test(leaderPaneId) || !ownerId) throw new Error('invalid target'); Type guard
const isTmuxPaneId = (v: string): v is `%${number}` => /^%[0-9]+$/.test(v); Prevention
- Pass pane ids straight from tmux list-panes format output
- Never strip the % prefix
When it happens
Trigger: Calling captureDetachedLeaderAuthority with a pane id lacking the `%` prefix (e.g. `123`), an empty string, or an empty ownerId.
Common situations: Parsing tmux output that changed format; passing a window id (@N) instead of pane id; internal refactors dropping ownerId.
Related errors
- malformed detached leader authority
- invalid auth slot path
- detached session did not report a leader pane id
- shutdown_shared_session_${kind.replaceAll(' ', '_')}_pid_mis
- sanitizeTeamName: empty after sanitization
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/6295ba209890c723.
Report an issue: GitHub.