{"record":{"id":"c5c8f10483770218","repo":"openai/codex-plugin-cc","slug":"root-requires-a-directory","errorCode":null,"errorMessage":"--root requires a directory.","messagePattern":"--root requires a directory\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/bump-version.mjs","lineNumber":103,"sourceCode":"  ].join(\"\\n\");\n}\n\nfunction parseArgs(argv) {\n  const options = {\n    check: false,\n    root: process.cwd(),\n    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","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/scripts/bump-version.mjs#L85-L121","documentation":"Thrown by parseArgs() in bump-version.mjs when the --root flag is the last token on the command line with no value following it. The parser reads argv[i+1] and requires it to be truthy; a missing directory argument is rejected before path resolution.","triggerScenarios":"Running `node scripts/bump-version.mjs --root` (flag at end) or `... --root --check` (next token is another flag, though note the parser only checks truthiness, so a following flag would actually be consumed — the real trigger is --root as the final arg). The strict trigger is: argv[i]==='--root' and argv[i+1] is undefined.","commonSituations":"Shell quoting accident truncating the path; a copy-pasted command missing the directory; script wrapper that conditionally appends --root but omits the value.","solutions":["Supply a directory after --root: `node scripts/bump-version.mjs --root /path/to/repo 1.0.0`.","If you meant the current directory, pass `.` explicitly: --root .","In wrapper scripts, guard that the root value is set before appending the flag."],"exampleFix":"// before\n$ node scripts/bump-version.mjs --root\n\n// after\n$ node scripts/bump-version.mjs --root . 1.0.0","handlingStrategy":"validation","validationCode":"function parseBumpArgs(argv) {\n  const i = argv.indexOf(\"--root\");\n  if (i !== -1 && (i === argv.length - 1 || argv[i + 1].startsWith(\"-\"))) {\n    throw new Error(\"--root requires a directory argument.\");\n  }\n  // ...then delegate to the real parser\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --root with an explicit path (use '.' for cwd).","In wrapper scripts, assert the root value is non-empty before appending the flag.","Use --help to confirm flag syntax before first run."],"tags":["cli","args","bump-version","validation"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}