Yeachan-Heo/oh-my-codex · error · Error
malformed detached leader authority
Error message
malformed detached leader authority
What it means
After querying tmux display-message, the helper expects exactly 7 tab-separated fields. A different count means the tmux output format didn't match expectations (old/new tmux version, format string mismatch, or error text in output).
Source
Thrown at src/cli/index.ts:1516
};
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. */
export function parseDetachedLeaderPaneIdByPid(snapshot: string, leaderPid: number): string {
if (!Number.isSafeInteger(leaderPid) || leaderPid <= 0) throw new Error("invalid detached leader pid");
const matches = snapshot
.split("\n")
.map((line) => line.trim())
.filter(Boolean)View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Run the display-message command manually with -t <pane> and inspect the output
- Verify the tmux version supports all used format variables
- Check that the target pane still exists
Defensive patterns
Strategy: try-catch
Validate before calling
const fields = output.trim().split('\t');
if (fields.length !== 7) throw new Error('unexpected tmux output'); Try / catch
catch (e) { if (e.message === 'malformed detached leader authority') { /* log raw tmux output, re-discover leader */ } } Prevention
- Pin a tested tmux version
- Log raw display-message output when debugging
When it happens
Trigger: execTmuxFileSync returns output that splits into != 7 fields — e.g. tmux emitted an error, or the format specifier was altered.
Common situations: Tmux version differences changing format expansion; target pane missing causing error output; locale/format regressions.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- invalid detached leader authority target
- invalid auth slot path
- shutdown_shared_session_${kind.replaceAll(' ', '_')}_pid_mis
- sanitizeTeamName: empty after sanitization
- sendToWorker: text must be < 200 characters
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/dd8be27369cd8342.
Report an issue: GitHub.