{"record":{"id":"8ab35bebca6bcd4a","repo":"openai/codex-plugin-cc","slug":"unexpected-extra-argument-arg","errorCode":null,"errorMessage":"Unexpected extra argument: ${arg}","messagePattern":"Unexpected extra argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/bump-version.mjs","lineNumber":112,"sourceCode":"\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) {\n  if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n    throw new Error(`Expected ${label} to be an object.`);","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/scripts/bump-version.mjs#L94-L130","documentation":"Thrown by parseArgs() in bump-version.mjs when a second positional (non-dash) argument is encountered after a version was already assigned. The command accepts at most one positional argument (the version); any extra positional is rejected.","triggerScenarios":"Running `node scripts/bump-version.mjs 1.0.0 2.0.0` or `... 1.0.0 extra`. Once options.version is set, the next non-flag token triggers the error.","commonSituations":"Pasting two version numbers; an unquoted argument that shell-split into two tokens; intending --check but typing a bare word; a stray path or note appended to the command.","solutions":["Provide exactly one version positional: `node scripts/bump-version.mjs 1.0.0`.","Quote any argument that contains spaces so it stays a single token.","Remove the extra token; use flags (not positionals) for modifiers."],"exampleFix":"// before\n$ node scripts/bump-version.mjs 1.0.0 2.0.0\n\n// after\n$ node scripts/bump-version.mjs 1.0.0","handlingStrategy":"validation","validationCode":"function countPositionals(argv) {\n  return argv.filter((a) => !a.startsWith(\"-\") && !(argv[argv.indexOf(a) - 1] === \"--root\")).length;\n}\nif (countPositionals(argv) > 1) {\n  throw new Error(\"Only one positional argument (the version) is accepted.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass exactly one version positional; quote any value containing spaces.","Do not append notes or extra paths to the bump-version command.","Use flags (not extra positionals) for any modifiers."],"tags":["cli","args","bump-version","arity"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}