{"record":{"id":"578274f43aa4b8f4","repo":"stablyai/orca","slug":"plugin-catalog-requires-a-json-catalog-path","errorCode":null,"errorMessage":"--plugin-catalog requires a JSON catalog path","messagePattern":"--plugin-catalog requires a JSON catalog path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/scripts/verify-localization-catalog.mjs","lineNumber":388,"sourceCode":"      if (genericTermRegressions.length > 20) {\n        console.error(`...and ${genericTermRegressions.length - 20} more generic term regressions`)\n      }\n    }\n    return 1\n  }\n\n  console.log(`Verified ${localeEntries.size} existing ${localeName}.json entries.`)\n  return 0\n}\n\nfunction parseArgs(argv) {\n  const pluginCatalogs = []\n  for (let index = 0; index < argv.length; index += 1) {\n    const argument = argv[index]\n    if (argument === '--plugin-catalog') {\n      const catalogPath = argv[index + 1]\n      if (!catalogPath || catalogPath.startsWith('--')) {\n        throw new Error('--plugin-catalog requires a JSON catalog path')\n      }\n      pluginCatalogs.push(catalogPath)\n      index += 1\n    } else if (argument.startsWith('--plugin-catalog=')) {\n      pluginCatalogs.push(argument.slice('--plugin-catalog='.length))\n    }\n  }\n  return {\n    fix: argv.includes('--fix'),\n    pluginCatalogs\n  }\n}\n\nasync function reportPluginCatalog(root, catalog, pluginCatalogPath) {\n  const resolvedPath = path.resolve(root, pluginCatalogPath)\n  let pluginCatalog\n  try {\n    pluginCatalog = JSON.parse(await fs.readFile(resolvedPath, 'utf8'))","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/verify-localization-catalog.mjs#L370-L406","documentation":"Thrown by the localization catalog verification script's argument parser when --plugin-catalog is passed but the next argument is either missing (end of argv) or is itself another flag (starts with --). The parser expects --plugin-catalog to be immediately followed by a JSON file path, or alternatively used as --plugin-catalog=<path>.","triggerScenarios":"Calling the script with --plugin-catalog as the last argument with no path following it; placing another flag like --fix immediately after --plugin-catalog; misspelling the path as another flag name.","commonSituations":"A CI pipeline or Makefile constructs the command dynamically and omits the path variable when it's empty; a developer adds --plugin-catalog to the command but forgets the path argument; a shell quoting issue causes the path to be consumed or split incorrectly.","solutions":["Provide the JSON catalog path immediately after --plugin-catalog: node config/scripts/verify-localization-catalog.mjs --plugin-catalog path/to/catalog.json","Alternatively use the equals form which is self-contained: --plugin-catalog=path/to/catalog.json","If constructing the command in CI, ensure the path variable is non-empty before appending the flag, or use the equals form to avoid positional ambiguity."],"exampleFix":"// before (CI script with potentially empty variable)\n//   node config/scripts/verify-localization-catalog.mjs --plugin-catalog ${CATALOG_PATH}\n//\n// after (guard against empty, use equals form)\n//   ARGS=\"\"\n//   [ -n \"$CATALOG_PATH\" ] && ARGS=\"--plugin-catalog=$CATALOG_PATH\"\n//   node config/scripts/verify-localization-catalog.mjs $ARGS","handlingStrategy":"validation","validationCode":"// Validate --plugin-catalog args before passing them to the script.\nfunction buildCatalogArgs(catalogPaths) {\n  const valid = catalogPaths.filter((p) => p && !p.startsWith('--') && p.endsWith('.json'))\n  if (valid.length !== catalogPaths.length) {\n    throw new Error(\n      `Invalid catalog paths: ${catalogPaths.filter((p) => !valid.includes(p)).join(', ')}`\n    )\n  }\n  return valid.map((p) => `--plugin-catalog=${p}`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the --plugin-catalog=<path> equals form in CI scripts to avoid positional ambiguity when variables are empty.","In CI pipelines, guard dynamic command construction: only append --plugin-catalog when the path variable is non-empty.","Add a quick pre-flight check that each catalog path exists as a .json file before invoking the script."],"tags":["arg-parsing","localization","plugin-catalog","cli","validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}