affaan-m/ECC · error

Choose only one output format: --json or --markdown

Error message

Choose only one output format: --json or --markdown

What it means

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.

Solutions

  1. Keep only one of --json or --markdown on the command line.
  2. If a wrapper or alias adds a format flag, remove or override it so only one is set.
  3. Call the script twice with different formats if both outputs are needed.

Example fix

// before
node scripts/status.js --json --markdown
// after
node scripts/status.js --json
Defensive patterns

Strategy: validation

Validate before calling

const chosen = ['--json', '--markdown'].filter(f => process.argv.includes(f));
if (chosen.length > 1) throw new Error('Choose only one output format: --json or --markdown');

Try / catch

try {
  runStatus(argv);
} catch (e) {
  if (e.message.includes('Choose only one output format')) {
    console.error('Pass either --json or --markdown, not both.');
    process.exitCode = 1;
  } else throw e;
}

Prevention

When it happens

Trigger: Running `node scripts/status.js --json --markdown`; both parsed.json and parsed.markdown become true and the post-parse guard throws.

Common situations: 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.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/b5aeca790814658a. Report an issue: GitHub.

Appendix: source

Thrown at scripts/status.js:63

    } 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 8321021c54)