{"record":{"id":"754f644d15e370dd","repo":"affaan-m/ECC","slug":"unknown-argument-arg-754f64","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/status.js","lineNumber":58,"sourceCode":"    if (arg === '--db') {\n      parsed.dbPath = args[index + 1] || null;\n      index += 1;\n    } else if (arg === '--json') {\n      parsed.json = true;\n    } else if (arg === '--markdown') {\n      parsed.markdown = true;\n    } else if (arg === '--exit-code') {\n      parsed.exitCode = true;\n    } else if (arg === '--write') {\n      parsed.writePath = args[index + 1] || null;\n      index += 1;\n    } else if (arg === '--limit') {\n      parsed.limit = args[index + 1] || null;\n      index += 1;\n    } else if (arg === '--help' || arg === '-h') {\n      parsed.help = true;\n    } else {\n      throw new Error(`Unknown argument: ${arg}`);\n    }\n  }\n\n  if (parsed.json && parsed.markdown) {\n    throw new Error('Choose only one output format: --json or --markdown');\n  }\n\n  if (args.includes('--db') && !parsed.dbPath) {\n    throw new Error('Missing value for --db');\n  }\n\n  if (args.includes('--write') && !parsed.writePath) {\n    throw new Error('Missing value for --write');\n  }\n\n  if (args.includes('--limit') && !parsed.limit) {\n    throw new Error('Missing value for --limit');\n  }","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/status.js#L40-L76","documentation":"parseArgs in scripts/status.js matches each argv token against a whitelist of flags (--limit, --help/-h, etc.). Any unrecognized token hits the final else branch, which throws \"Unknown argument: <arg>\". The script deliberately rejects rather than ignores unknown flags so mistakes surface immediately.","triggerScenarios":"Running `node scripts/status.js --form json` (typo for --format or a nonexistent flag), or passing options belonging to other ECC scripts like --panel to status.js.","commonSituations":"Typos in flag names; reusing command lines across different ECC scripts; stale documentation or shell aliases from an older script version.","solutions":["Run `node scripts/status.js --help` to see the supported flag list.","Fix the flag spelling (e.g. --json, --markdown, --db, --write, --limit).","Remove arguments intended for a different script."],"exampleFix":"// before\nnode scripts/status.js --form json\n// after\nnode scripts/status.js --json","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['--json', '--markdown', '--db', '--write', '--limit', '--help', '-h']);\nconst unknown = argv.filter(a => a.startsWith('--') && !SUPPORTED.has(a) && a !== '-h');\nif (unknown.length) console.error('Unsupported flags:', unknown);","typeGuard":null,"tryCatchPattern":"try {\n  runStatus(argv);\n} catch (e) {\n  if (e.message.startsWith('Unknown argument')) {\n    console.error(`${e.message}. See: node scripts/status.js --help`);\n    process.exitCode = 1;\n  } else throw e;\n}","preventionTips":["Run scripts/status.js --help to enumerate valid flags before composing commands.","Verify flag names against this script, not other ECC scripts.","Lint wrapper scripts that interpolate flag names."],"tags":["cli","argument-parsing","unknown-flag"],"backgroundTag":"invalid-cli-argument","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}