affaan-m/ECC · error · Error
Usage: legacy-sync-state.js…
Error message
Usage: legacy-sync-state.js <begin|record|finalize|rollback> [options]
What it means
Printed as a usage error when argv[0] does not match any known subcommand (begin, record, finalize, rollback) in legacy-sync-state.js main; the command string is missing or unrecognized.
Solutions
- Run with one of: begin, record, finalize, rollback followed by its required flags.
- Check the calling script invokes the right subcommand.
- See scripts/lib/codex-legacy-sync for the underlying operations.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at scripts/codex/legacy-sync-state.js:54 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/49cdb889ba802a53.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/codex/legacy-sync-state.js:54
if (!statePath || !filePath) throw new Error('record requires --state and --path');
recordLegacySyncPath({ statePath, filePath });
return;
}
if (command === 'finalize') {
const statePath = readFlag(argv, '--state');
if (!statePath) throw new Error('finalize requires --state');
finalizeLegacySyncState({ statePath });
return;
}
if (command === 'rollback') {
const statePath = readFlag(argv, '--state');
if (!statePath) throw new Error('rollback requires --state');
const result = rollbackLegacyCodexSync({ statePath });
process.stdout.write(`${JSON.stringify(result)}\n`);
if (result.status !== 'rolled-back') process.exitCode = 1;
return;
}
throw new Error('Usage: legacy-sync-state.js <begin|record|finalize|rollback> [options]');
}
module.exports = { main, readFlag };
if (require.main === module) {
try {
main();
} catch (error) {
process.stderr.write(`[ecc-sync] ERROR: ${error.message}\n`);
process.exit(1);
}
}
View on GitHub (pinned to 8321021c54)