{"record":{"id":"b5aeca790814658a","repo":"affaan-m/ECC","slug":"choose-only-one-output-format-json-or-markdow","errorCode":null,"errorMessage":"Choose only one output format: --json or --markdown","messagePattern":"Choose only one output format: --json or --markdown","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/status.js","lineNumber":63,"sourceCode":"    } 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  }\n\n  return parsed;\n}\n\nfunction printActiveSessions(section) {","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/status.js#L45-L81","documentation":"scripts/status.js supports two mutually exclusive output formats, --json and --markdown. After parsing, parseArgs checks whether both were set and throws \"Choose only one output format\" if so. The formats cannot be combined because the script renders either a JSON payload or a Markdown report, not both.","triggerScenarios":"Running `node scripts/status.js --json --markdown`; both parsed.json and parsed.markdown become true and the post-parse guard throws.","commonSituations":"Combining flags from two example commands; a wrapper script appending its own default format flag while the user also passed one; shell aliases adding --json automatically.","solutions":["Keep only one of --json or --markdown on the command line.","If a wrapper or alias adds a format flag, remove or override it so only one is set.","Call the script twice with different formats if both outputs are needed."],"exampleFix":"// before\nnode scripts/status.js --json --markdown\n// after\nnode scripts/status.js --json","handlingStrategy":"validation","validationCode":"const chosen = ['--json', '--markdown'].filter(f => process.argv.includes(f));\nif (chosen.length > 1) throw new Error('Choose only one output format: --json or --markdown');","typeGuard":null,"tryCatchPattern":"try {\n  runStatus(argv);\n} catch (e) {\n  if (e.message.includes('Choose only one output format')) {\n    console.error('Pass either --json or --markdown, not both.');\n    process.exitCode = 1;\n  } else throw e;\n}","preventionTips":["Pick one output format per invocation; run twice if you need both.","Audit aliases/wrappers that may inject a default format flag.","Centralize format selection in one variable in wrapper scripts."],"tags":["cli","mutually-exclusive","flags"],"backgroundTag":"mutually-exclusive-flags","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"}