affaan-m/ECC · error · Error
--write requires --json or --markdown
Error message
--write requires --json or --markdown
What it means
Thrown by scripts/status.js during output dispatch (after the state store has been queried) when --write was supplied but neither --json nor --markdown was selected. --write persists the rendered machine format to disk, and the human-readable console output (the default branch) is not a stable format worth writing to a file, so the combination is rejected. Unlike the parse-time errors, this fires late, after the database query succeeds.
Source
Thrown at scripts/status.js:470
}),
};
payload.githubCoordination = summarizeGithubCoordination(payload.workItems);
if (options.json) {
const output = `${JSON.stringify(payload, null, 2)}\n`;
if (options.writePath) {
writeOutput(options.writePath, output);
}
process.stdout.write(output);
} else if (options.markdown) {
const output = renderMarkdown(payload);
if (options.writePath) {
writeOutput(options.writePath, output);
}
process.stdout.write(output);
} else {
if (options.writePath) {
throw new Error('--write requires --json or --markdown');
}
printHuman(payload);
}
if (options.exitCode && payload.readiness.status !== 'ok') {
process.exitCode = 2;
}
} catch (error) {
console.error(`Error: ${error.message}`);
process.exit(1);
} finally {
if (store) {
store.close();
}
}
}
if (require.main === module) {View on GitHub (pinned to 01e15490f0)
Solutions
- Add --json or --markdown alongside --write: `node scripts/status.js --markdown --write status.md`.
- If you only want on-screen human output, remove --write.
- Restructure the wrapper so the format flag and --write are set together in the same conditional branch.
Example fix
// before node scripts/status.js --write /tmp/status.txt // after node scripts/status.js --json --write /tmp/status.json
Defensive patterns
Strategy: validation
Validate before calling
// Enforce: --write only when a format flag is also present
function buildStatusArgs(opts) {
const args = [];
if (opts.format === 'json' || opts.format === 'markdown') {
args.push(`--${opts.format}`);
} else {
return args; // human mode, no --write allowed
}
if (opts.outFile) args.push('--write', opts.outFile);
return args;
} Prevention
- Treat --write as subordinate to a format flag; never emit it independently.
- Document that the human view is console-only and cannot be redirected via --write.
- Add a unit test asserting --write without a format flag is rejected.
When it happens
Trigger: `node scripts/status.js --write report.txt` with no format flag; a wrapper that always sets --write but only conditionally sets --json/--markdown and hits the branch where neither is set.
Common situations: Assuming --write implies a default format; migrating a command that previously wrote human text to a file; a script that builds flags in separate conditionals and the format flag was skipped.
Related errors
- Choose only one output format: --json or --markdown
- Missing value for --write
- Agents directory not found: ${dirPath}
- Expected a directory: ${dirPath}
- Invalid format: ${parsed.format}. Use text or json.
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/23f24c791b4d4656.
Report an issue: GitHub.