{"record":{"id":"4556358730a43421","repo":"Yeachan-Heo/oh-my-codex","slug":"usage-omx-exec-inject-session-id-prompt-text","errorCode":null,"errorMessage":"Usage: omx exec inject <session-id> --prompt <text> [--actor <name>] [--json]","messagePattern":"Usage: omx exec inject <session-id> --prompt <text> \\[--actor <name>\\] \\[--json\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/exec/followup.ts","lineNumber":365,"sourceCode":"}\n\nexport function formatInjectExecFollowupSuccess(result: InjectExecFollowupResult): string {\n  return [\n    `Queued exec follow-up ${result.queued.id} for session ${result.queued.session_id}.`,\n    `Queue: ${result.queuePath}`,\n    \"Delivery: next Stop hook checkpoint; no tmux pane input was sent.\",\n  ].join(\"\\n\");\n}\n\nexport function parseExecInjectArgs(args: string[]): {\n  sessionId: string;\n  prompt: string;\n  actor?: string;\n  json: boolean;\n} {\n  const [, sessionIdRaw, ...rest] = args;\n  const sessionId = sessionIdRaw?.trim();\n  if (!sessionId) throw new Error(\"Usage: omx exec inject <session-id> --prompt <text> [--actor <name>] [--json]\");\n\n  let prompt = \"\";\n  let actor: string | undefined;\n  let json = false;\n  for (let i = 0; i < rest.length; i += 1) {\n    const arg = rest[i]!;\n    if (arg === \"--json\") {\n      json = true;\n    } else if (arg === \"--prompt\") {\n      const value = rest[i + 1];\n      if (!value) throw new Error(\"Missing value after --prompt\");\n      prompt = value;\n      i += 1;\n    } else if (arg.startsWith(\"--prompt=\")) {\n      prompt = arg.slice(\"--prompt=\".length);\n    } else if (arg === \"--prompt-file\") {\n      const value = rest[i + 1];\n      if (!value) throw new Error(\"Missing path after --prompt-file\");","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/exec/followup.ts#L347-L383","documentation":"Usage error from parseExecInjectArgs when the `omx exec inject` CLI is invoked without a session id positional argument. The parser takes the first positional as the session id; if it is missing or whitespace-only, this usage string is thrown instead of attempting anything.","triggerScenarios":"Running `omx exec inject` with no arguments; passing only flags (e.g. `omx exec inject --prompt hi`) so the first token is consumed as a flag, not a session id; passing a session id of only whitespace; shell quoting that drops the argument.","commonSituations":"Shell script passes an unset $SESSION_ID variable; user copies the example command but deletes the id placeholder; flags placed before the positional id get consumed as the id slot value incorrectly; CI template renders an empty id.","solutions":["Provide the session id as the first positional: `omx exec inject <session-id> --prompt <text>`.","If using a variable, verify it is non-empty first: `[ -n \"$SESSION_ID\" ] || exit 1`.","Put the session id before all flags to avoid it being parsed as a flag value.","Re-check quoting/quoting of arguments in scripts and CI templates."],"exampleFix":"# before\nomx exec inject --prompt \"rerun the tests\"\n\n# after\nomx exec inject \"$SESSION_ID\" --prompt \"rerun the tests\"","handlingStrategy":"validation","validationCode":"const sessionId = process.env.SESSION_ID?.trim();\nif (!sessionId) { console.error('SESSION_ID is required'); process.exit(1); }\nrunCli(['exec', 'inject', sessionId, '--prompt', text]);","typeGuard":"function isSessionIdArg(v: string | undefined): v is string {\n  return typeof v === 'string' && v.trim().length > 0 && !v.startsWith('-');\n}","tryCatchPattern":"catch (e) { if (e instanceof Error && e.message.startsWith('Usage: omx exec inject')) { console.error(e.message); process.exit(2); } throw e; }","preventionTips":["Assert positional id variables are non-empty before invoking the CLI.","Place the session id before any flags.","Use shell parameter defaults like ${SESSION_ID:?required}."],"tags":["cli","usage-error","argument-parsing","exec-followup"],"backgroundTag":"missing-cli-argument","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}