{"record":{"id":"5ef6b3765c9c8c13","repo":"Yeachan-Heo/oh-my-codex","slug":"tmux-pane-requires-a-pane-id-sparkshell-usage","errorCode":null,"errorMessage":"--tmux-pane requires a pane id.\n${SPARKSHELL_USAGE}","messagePattern":"--tmux-pane requires a pane id\\.\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/sparkshell.ts","lineNumber":332,"sourceCode":"    if (!script.trim()) throw new Error(`--shell requires a command string.\\n${SPARKSHELL_USAGE}`);\n    if (args.length !== 1) throw new Error(`--shell does not accept additional arguments.\\n${SPARKSHELL_USAGE}`);\n    return { kind: 'command', argv: resolveFallbackShellArgv(script, options) };\n  }\n\n  const paneStart = args.findIndex((arg) => arg === '--tmux-pane' || arg.startsWith('--tmux-pane='));\n  if (paneStart < 0) {\n    return { kind: 'command', argv: [...args] };\n  }\n\n  let paneId: string | undefined;\n  let tailLines = 200;\n  let sawTailLines = false;\n\n  for (let index = 0; index < args.length; index += 1) {\n    const token = args[index];\n    if (token === '--tmux-pane') {\n      const next = args[index + 1];\n      if (!next || next.startsWith('-')) throw new Error(`--tmux-pane requires a pane id.\\n${SPARKSHELL_USAGE}`);\n      paneId = next;\n      index += 1;\n      continue;\n    }\n    if (token.startsWith('--tmux-pane=')) {\n      const value = token.slice('--tmux-pane='.length).trim();\n      if (!value) throw new Error(`--tmux-pane requires a pane id.\\n${SPARKSHELL_USAGE}`);\n      paneId = value;\n      continue;\n    }\n    if (token === '--tail-lines') {\n      const next = args[index + 1];\n      if (!next || next.startsWith('-')) throw new Error(`--tail-lines requires a numeric value.\\n${SPARKSHELL_USAGE}`);\n      const parsed = Number.parseInt(next, 10);\n      if (!Number.isFinite(parsed) || parsed < 100 || parsed > 1000) {\n        throw new Error(`--tail-lines must be an integer between 100 and 1000.\\n${SPARKSHELL_USAGE}`);\n      }\n      tailLines = parsed;","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/sparkshell.ts#L314-L350","documentation":"The sparkshell CLI was invoked in tmux-pane mode (--tmux-pane) but the flag was not followed by a pane id: either it was the last token or the next token looked like another option. The parser guards this invariant before building the tmux capture-pane argv.","triggerScenarios":"Running `sparkshell --tmux-pane` with no argument, or `sparkshell --tmux-pane --tail-lines 200` where the next token starts with '-'.","commonSituations":"Shell quoting mistakes, forgetting to run `tmux list-panes` to get the pane id first, or writing flags in an order that puts another option right after --tmux-pane.","solutions":["Supply a pane id: `sparkshell --tmux-pane 3`","Use the equals form: `sparkshell --tmux-pane=3`","Get valid ids via `tmux list-panes -F '#{pane_id}'`"],"exampleFix":"# before\nsparkshell --tmux-pane --tail-lines 200\n# after\nsparkshell --tmux-pane %1 --tail-lines 200","handlingStrategy":"validation","validationCode":"const ok = (args: string[]) =>\n  !args.includes('--tmux-pane') ||\n  args.some((a, i) => (a === '--tmux-pane' && args[i+1] && !args[i+1].startsWith('-')) || a.startsWith('--tmux-pane=') && a.length > '--tmux-pane='.length);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always fetch the pane id from `tmux list-panes -F '#{pane_id}'` before invoking","Prefer the --tmux-pane=<id> form to avoid ordering issues"],"tags":["cli","tmux","argument-validation"],"backgroundTag":"missing-cli-argument","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}