{"record":{"id":"1509141510e59347","repo":"openai/codex-plugin-cc","slug":"unknown-option-arg","errorCode":null,"errorMessage":"Unknown option: ${arg}","messagePattern":"Unknown option: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/bump-version.mjs","lineNumber":110,"sourceCode":"    version: null\n  };\n\n  for (let i = 0; i < argv.length; i += 1) {\n    const arg = argv[i];\n\n    if (arg === \"--check\") {\n      options.check = true;\n    } else if (arg === \"--root\") {\n      const root = argv[i + 1];\n      if (!root) {\n        throw new Error(\"--root requires a directory.\");\n      }\n      options.root = root;\n      i += 1;\n    } else if (arg === \"--help\" || arg === \"-h\") {\n      options.help = true;\n    } else if (arg.startsWith(\"-\")) {\n      throw new Error(`Unknown option: ${arg}`);\n    } else if (options.version) {\n      throw new Error(`Unexpected extra argument: ${arg}`);\n    } else {\n      options.version = arg;\n    }\n  }\n\n  options.root = path.resolve(options.root);\n  return options;\n}\n\nfunction validateVersion(version) {\n  if (!VERSION_PATTERN.test(version)) {\n    throw new Error(`Expected a semver-like version such as 1.0.3, got: ${version}`);\n  }\n}\n\nfunction requireObject(value, label) {","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/scripts/bump-version.mjs#L92-L128","documentation":"Thrown by parseArgs() in bump-version.mjs for any token starting with '-' that is not one of the recognised flags (--check, --root, --help, -h). It is the catch-all for unrecognized options, enforcing a closed flag set.","triggerScenarios":"Passing an unsupported flag such as --dry-run, --force, -v, --prerelease, or any mistyped flag (e.g. --checl). Any token matching /^-/ that is not explicitly handled hits this branch.","commonSituations":"Typo in a flag name; assuming a common flag (like --force or --dry-run) exists when it doesn't; passing a global flag meant for a different tool; negative-number or dash-leading value mistaken for an option.","solutions":["Remove the unknown flag or replace it with a supported one (--check, --root, --help, -h).","Run with --help to see the accepted options.","If passing a value that starts with '-', restructure so it is not the first token or is not dash-prefixed."],"exampleFix":"// before\n$ node scripts/bump-version.mjs --dry-run 1.0.0\n\n// after\n$ node scripts/bump-version.mjs 1.0.0","handlingStrategy":"validation","validationCode":"const SUPPORTED_FLAGS = new Set([\"--check\", \"--root\", \"--help\", \"-h\"]);\n\nfunction validateFlags(argv) {\n  for (const a of argv) {\n    if (a.startsWith(\"-\") && !SUPPORTED_FLAGS.has(a) && !(argv[argv.indexOf(a) - 1] === \"--root\")) {\n      throw new Error(`Unknown option: ${a}. Supported: ${[...SUPPORTED_FLAGS].join(\", \")}`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run with --help to see accepted flags before passing others.","Keep a constants list of supported flags in wrappers and validate against it.","Avoid dash-prefixed positional values; pass versions as bare tokens."],"tags":["cli","args","bump-version","unknown-option"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}