{"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":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/status.js","lineNumber":59,"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":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/status.js#L41-L77","documentation":"Thrown by scripts/status.js after argument parsing when both --json and --markdown are set. The status command can only emit one machine-readable format per run because each format writes directly to stdout (and optionally --write), so requesting both is ambiguous and rejected. This is a mutual-exclusion guard enforced after the parse loop completes.","triggerScenarios":"Passing both format flags in one invocation: `node scripts/status.js --json --markdown`. Common when a wrapper script accumulates flags from multiple environment conditions without clearing the prior choice, or when a user toggles both while experimenting.","commonSituations":"A CI pipeline that picks --json for machines but accidentally also sets --markdown from a prior step; shell scripts that build a flag string conditionally and both conditions evaluate true; copy-pasting a command that already had one format flag and appending the other.","solutions":["Remove one of the two format flags so only --json or only --markdown remains.","If you need both formats, run the command twice — once per format — writing to separate files via --write.","Audit the wrapper script or CI step that assembles the flags to ensure the format choice is mutually exclusive (use if/else, not independent appends)."],"exampleFix":"// before\nnode scripts/status.js --json --markdown\n\n// after\nnode scripts/status.js --json","handlingStrategy":"validation","validationCode":"// Ensure --json and --markdown are never both set\nfunction pickFormat(argv, prefer = 'json') {\n  const out = argv.filter(f => f !== '--json' && f !== '--markdown');\n  out.push(prefer === 'markdown' ? '--markdown' : '--json');\n  return out;\n}\n// pickFormat(['--json', '--markdown', '--limit', '5'], 'json'); // ['--limit','5','--json']","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose the format via a single if/else, never two independent appends.","In CI, derive the format from one variable and inject exactly one flag.","If you need both formats, run two separate processes writing to distinct --write paths."],"tags":["cli","output-format","conflict","status","validation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}