{"record":{"id":"b461138866612326","repo":"stablyai/orca","slug":"usage-node-config-scripts-compare-benchmark-artif","errorCode":null,"errorMessage":"Usage: node config/scripts/compare-benchmark-artifacts.mjs --baseline <path> --candidate <path> [--title <title>] [--output <path>] [--json-output <path>] [--higher-is-better <metric-key> ...]","messagePattern":"Usage: node config/scripts/compare-benchmark-artifacts\\.mjs --baseline <path> --candidate <path> \\[--title <title>\\] \\[--output <path>\\] \\[--json-output <path>\\] \\[--higher-is-better <metric-key> \\.\\.\\.\\]","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/compare-benchmark-artifacts.mjs","lineNumber":52,"sourceCode":"      continue\n    }\n    if (flag === '--json-output') {\n      parsed.jsonOutputPath = readRequiredValue(args, ++index, '--json-output requires a path')\n      continue\n    }\n    if (flag === '--higher-is-better') {\n      let consumed = 0\n      while (args[index + 1] != null && !args[index + 1].startsWith('--')) {\n        parsed.higherIsBetter.add(args[index + 1])\n        index += 1\n        consumed += 1\n      }\n      if (consumed === 0) {\n        throw new Error('--higher-is-better requires a metric key')\n      }\n      continue\n    }\n    throw new Error(USAGE)\n  }\n\n  if (!parsed.baselinePath) {\n    throw new Error(USAGE)\n  }\n  if (!parsed.candidatePath) {\n    throw new Error(USAGE)\n  }\n  return parsed\n}\n\nfunction readRequiredValue(args, index, message) {\n  const value = args[index]\n  if (value == null || value.startsWith('--')) {\n    throw new Error(message)\n  }\n  return value\n}","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/compare-benchmark-artifacts.mjs#L34-L70","documentation":"Thrown by parseBenchmarkComparisonArgs as the USAGE message in two cases: (1) an unrecognized flag was passed (the final `throw new Error(USAGE)` in the loop), or (2) --baseline or --candidate was not provided (the two post-loop checks). The full usage string documents every accepted flag.","triggerScenarios":"Passing an unknown flag like --verbose or --format; misspelling --baseline as --base; omitting --baseline and/or --candidate entirely; passing --baseline without a value (caught earlier by readRequiredValue but a missing required flag falls through here).","commonSituations":"Operator ran the script with no args expecting a help message; a CI workflow template lost its --baseline substitution; copy-paste from an older version of the script that accepted different flags.","solutions":["Provide both required flags: --baseline <baseline.json> --candidate <candidate.json>.","Remove any unrecognized flags or check the spelling against the USAGE line.","Run the script with no args to print USAGE intentionally, then construct the real command.","In CI, assert both $BASELINE and $CANDIDATE are non-empty before invoking."],"exampleFix":"// before\n// node config/scripts/compare-benchmark-artifacts.mjs --base a.json --candidate b.json\n// -> 'Usage: node config/scripts/compare-benchmark-artifacts.mjs --baseline <path> ...'\n\n// after\n// node config/scripts/compare-benchmark-artifacts.mjs --baseline a.json --candidate b.json","handlingStrategy":"validation","validationCode":"function assertRequiredArgs(parsed) {\n  if (!parsed.baselinePath || !parsed.candidatePath) {\n    throw new Error(USAGE)\n  }\n}\n// call after parseBenchmarkComparisonArgs","typeGuard":null,"tryCatchPattern":"try {\n  runBenchmarkComparisonCli()\n} catch (error) {\n  console.error(error.message)\n  process.exit(1)\n}","preventionTips":["Always pass both --baseline and --candidate with valid paths.","In CI, assert $BASELINE and $CANDIDATE are non-empty before invoking the script.","When extending the CLI with a new flag, update USAGE in the same change so the error message stays accurate."],"tags":["cli","arg-parsing","usage","benchmark","validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}