affaan-m/ECC · error · Error
Choose only one output format: --json or --markdown
Error message
Choose only one output format: --json or --markdown
What it means
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.
Source
Thrown at scripts/status.js:59
} else if (arg === '--markdown') {
parsed.markdown = true;
} else if (arg === '--exit-code') {
parsed.exitCode = true;
} else if (arg === '--write') {
parsed.writePath = args[index + 1] || null;
index += 1;
} else if (arg === '--limit') {
parsed.limit = args[index + 1] || null;
index += 1;
} else if (arg === '--help' || arg === '-h') {
parsed.help = true;
} else {
throw new Error(`Unknown argument: ${arg}`);
}
}
if (parsed.json && parsed.markdown) {
throw new Error('Choose only one output format: --json or --markdown');
}
if (args.includes('--db') && !parsed.dbPath) {
throw new Error('Missing value for --db');
}
if (args.includes('--write') && !parsed.writePath) {
throw new Error('Missing value for --write');
}
if (args.includes('--limit') && !parsed.limit) {
throw new Error('Missing value for --limit');
}
return parsed;
}
function printActiveSessions(section) {View on GitHub (pinned to 01e15490f0)
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).
Example fix
// before node scripts/status.js --json --markdown // after node scripts/status.js --json
Defensive patterns
Strategy: validation
Validate before calling
// Ensure --json and --markdown are never both set
function pickFormat(argv, prefer = 'json') {
const out = argv.filter(f => f !== '--json' && f !== '--markdown');
out.push(prefer === 'markdown' ? '--markdown' : '--json');
return out;
}
// pickFormat(['--json', '--markdown', '--limit', '5'], 'json'); // ['--limit','5','--json'] Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- --write requires --json or --markdown
- Unknown argument: ${arg}
- ${label} must be a positive integer
- Unknown install target: ${parsed.target}. Expected one of ${
- Consult requires a natural language query, for example: secu
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/b5aeca790814658a.
Report an issue: GitHub.