{"record":{"id":"d0100af1bbd58f56","repo":"affaan-m/ECC","slug":"unknown-argument-arg-d0100a","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/observability-readiness.js","lineNumber":68,"sourceCode":"    }\n\n    if (arg.startsWith('--format=')) {\n      parsed.format = arg.slice('--format='.length).toLowerCase();\n      continue;\n    }\n\n    if (arg === '--root') {\n      parsed.root = path.resolve(readValue(args, index, arg));\n      index += 1;\n      continue;\n    }\n\n    if (arg.startsWith('--root=')) {\n      parsed.root = path.resolve(arg.slice('--root='.length));\n      continue;\n    }\n\n    throw new Error(`Unknown argument: ${arg}`);\n  }\n\n  if (!['text', 'json'].includes(parsed.format)) {\n    throw new Error(`Invalid format: ${parsed.format}. Use text or json.`);\n  }\n\n  return parsed;\n}\n\nfunction fileExists(rootDir, relativePath) {\n  return fs.existsSync(path.join(rootDir, relativePath));\n}\n\nfunction readText(rootDir, relativePath) {\n  try {\n    return fs.readFileSync(path.join(rootDir, relativePath), 'utf8');\n  } catch (_error) {\n    return '';","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/observability-readiness.js#L50-L86","documentation":"Thrown by parseArgs in scripts/observability-readiness.js when a token starts with `--` but matches none of the recognized flags (--format, --root, --help/-h). The parser is a strict allowlist: any unrecognized flag is rejected rather than silently ignored.","triggerScenarios":"Passing a flag from a different tool (e.g. `--output`, `--quiet`, `--verbose`); typos like `--frm` or `--rot`; using a flag that exists in operator-readiness-dashboard.js but not here (these are two separate scripts with different flag sets).","commonSituations":"Confusing this script's flags with those of the sibling operator-readiness-dashboard.js (which accepts --json, --markdown, --write, etc.); copy-pasting a command from documentation for a different ECC script; an agent guessing flag names.","solutions":["Run `node scripts/observability-readiness.js --help` to see the accepted flags.","Remove or correct the offending flag; this script only accepts --format, --root, and --help/-h.","If you intended the richer dashboard flags, invoke operator-readiness-dashboard.js instead."],"exampleFix":"// before\nnode scripts/observability-readiness.js --json\n// after\nnode scripts/observability-readiness.js --format json","handlingStrategy":"validation","validationCode":"const OBS_FLAGS = new Set(['--format', '--root', '--help', '-h']);\nfunction assertKnownFlags(argv) {\n  for (const a of argv) {\n    if (a.startsWith('--') && !a.startsWith('--format=') && !a.startsWith('--root=') && !OBS_FLAGS.has(a)) {\n      throw new Error(`Unsupported flag for observability-readiness: ${a}`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not carry flags over from operator-readiness-dashboard.js — the two scripts have different surfaces.","Generate flags from a validated allowlist in your wrapper.","Run `--help` after upgrades to refresh the known set."],"tags":["cli","observability","argument-validation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}