{"record":{"id":"14ce1757a1866b69","repo":"Yeachan-Heo/oh-my-codex","slug":"unknown-exec-inject-argument-arg","errorCode":null,"errorMessage":"Unknown exec inject argument: ${arg}","messagePattern":"Unknown exec inject argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/exec/followup.ts","lineNumber":399,"sourceCode":"    } else if (arg === \"--prompt-file\") {\n      const value = rest[i + 1];\n      if (!value) throw new Error(\"Missing path after --prompt-file\");\n      prompt = readFileSyncForCli(value);\n      i += 1;\n    } else if (arg.startsWith(\"--prompt-file=\")) {\n      prompt = readFileSyncForCli(arg.slice(\"--prompt-file=\".length));\n    } else if (arg === \"--actor\") {\n      const value = rest[i + 1];\n      if (!value) throw new Error(\"Missing value after --actor\");\n      actor = value;\n      i += 1;\n    } else if (arg.startsWith(\"--actor=\")) {\n      actor = arg.slice(\"--actor=\".length);\n    } else if (!arg.startsWith(\"-\") && !prompt) {\n      prompt = [arg, ...rest.slice(i + 1)].join(\" \");\n      break;\n    } else {\n      throw new Error(`Unknown exec inject argument: ${arg}`);\n    }\n  }\n  return { sessionId, prompt, actor, json };\n}\n\nfunction readFileSyncForCli(path: string): string {\n  return readFileSync(path, \"utf-8\");\n}\n\nexport async function execInjectCommand(args: string[], cwd = process.cwd()): Promise<void> {\n  const parsed = parseExecInjectArgs(args);\n  const result = await injectExecFollowup({\n    cwd,\n    sessionId: parsed.sessionId,\n    prompt: parsed.prompt,\n    actor: parsed.actor,\n  });\n  if (parsed.json) {","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/exec/followup.ts#L381-L417","documentation":"Usage error from parseExecInjectArgs when a token starts with '-' but matches no recognized flag (--json, --prompt[=], --prompt-file[=], --actor[=]) and a prompt has already been set. The parser treats unknown dash-prefixed tokens as errors rather than silently ignoring them.","triggerScenarios":"Typos like `--promt`, `--Prompt`, `--jsn`; passing unsupported flags such as `--verbose` or `--dry-run` after the prompt is set; a negative-number or dash-leading prompt fragment arriving after --prompt was already assigned; combining flags in one token like `--json --actor`.","commonSituations":"User assumes an unrelated global flag works on the inject subcommand; typo in scripts; upgrading from a version whose flag set differed; passing '--' separator tokens unexpectedly.","solutions":["Fix the flag name — check the supported set in the usage string: --prompt[=], --prompt-file[=], --actor[=], --json.","Remove flags not supported by `omx exec inject`; they may belong on a parent command.","If the prompt itself starts with '-', pass it with --prompt=\"<text>\" or --prompt-file so it isn't parsed as a flag.","Re-run with only documented flags to isolate the offending token."],"exampleFix":"# before\nomx exec inject \"$SESSION_ID\" --prompt \"hi\" --verbose\n# throws: Unknown exec inject argument: --verbose\n\n# after\nomx exec inject \"$SESSION_ID\" --prompt \"hi\" --json","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['--json']);\nfor (const a of extraArgs) {\n  if (a.startsWith('-') && !ALLOWED.has(a) && !a.startsWith('--prompt') && !a.startsWith('--actor')) {\n    throw new Error(`unsupported flag ${a} for exec inject`);\n  }\n}","typeGuard":null,"tryCatchPattern":"catch (e) { const m = e instanceof Error && e.message.match(/^Unknown exec inject argument: (.+)$/); if (m) { console.error(`unsupported flag: ${m[1]}`); process.exit(2); } throw e; }","preventionTips":["Restrict user-supplied flags to the documented set before shell assembly.","Escape dash-leading prompt text with --prompt= or --prompt-file.","Pin and re-read the CLI flag list when upgrading omx versions."],"tags":["cli","usage-error","argument-parsing","unknown-flag"],"backgroundTag":"unknown-cli-flag","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}