affaan-m/ECC · error · Error
rollback requires --state
Error message
rollback requires --state
What it means
The 'rollback' subcommand of legacy-sync-state.js needs the --state flag identifying the sync state file to restore from; thrown from main when the --state readFlag lookup is empty.
Solutions
- Pass: rollback --state <stateFile> using the file from 'begin'.
- If the state file was deleted, rollback is impossible; restore from the backup directory manually.
- Check the installer error path preserved the state path.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at scripts/codex/legacy-sync-state.js:48 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/7a96bb6decf1a688.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/codex/legacy-sync-state.js:48
})}\n`);
return;
}
if (command === 'record') {
const statePath = readFlag(argv, '--state');
const filePath = readFlag(argv, '--path');
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)