JuliusBrussee/caveman · error
changed during interrupted install; refusing recovery
Error message
${operation.file} changed during interrupted ${agent} install; refusing recovery What it means
To roll back an interrupted install, each journaled operation's target file is hashed and compared against the journal's `after_sha256` (install applied) or `before_sha256`/absence (install not yet applied). If the file matches neither state, something modified it outside the journaled install, and replaying the rollback would destroy those changes, so recovery refuses.
Solutions
- Revert the file to either its pre-install content or the install's written content (check backups/editor history), then rerun recovery.
- If the new content is wanted, delete the pending journal and manually apply or skip the corresponding change, then rerun the install.
- Restore the file from version control or a backup so its hash matches the journaled before/after state.
- Compare the file against `after_sha256`/`before_sha256` in the pending journal to see which state it should be in.
Example fix
# before nano ~/.aider/config.yml # edits during pending recovery # after git checkout -- ~/.aider/config.yml && caveman doctor aider --fix
Defensive patterns
Strategy: try-catch
Validate before calling
import { createHash } from "node:crypto";
const sha = (b: Buffer | null) => b ? createHash("sha256").update(b).digest("hex") : null;
for (const op of pendingOps) {
const h = sha(fileBytes(op.file));
if (h !== op.after_sha256 && h !== op.before_sha256) console.error("file drifted from journal:", op.file);
} Type guard
const matchesJournalState = (h: string | null, op: { after_sha256: string; before_sha256?: string }) => h === op.after_sha256 || (op.before_sha256 != null && h === op.before_sha256); Try / catch
try { install(agent); } catch (e) { if (String(e.message).includes("changed during interrupted")) { restoreFileFromBackup(op.file) ?? discardPendingJournal(agent); } } Prevention
- Do not edit agent config files while an install/recovery is pending.
- Run recovery (doctor --fix) promptly after a crash, before other tools touch configs.
- Disable config-sync tools (dotfile managers) that might rewrite agent configs mid-install.
- Keep the agent config under version control so drift can be reverted.
When it happens
Trigger: Recovery runs while a journaled operation's file was edited after the interrupted install — e.g. the user changed the agent config, another tool rewrote it, or the install itself wrote an unexpected byte sequence.
Common situations: User manually edits their agent config between the crash and the retry; a config sync tool overwrites files; the agent app rewrites its own config on startup before caveman recovery runs.
Understand the failure class
Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.
Related errors
- conflicting committed and pending integration journals for
- MCP transaction journal already exists; refusing overwrite
- MCP transaction journals disagree; refusing recovery
- integration backup hash mismatch
- journal bytes do not match declared transaction state
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/ba03cba624f6f57a.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:8084
if (!pending) return false;
const committed = readNativeJournal(agent);
if (committed) {
if (JSON.stringify(committed) !== JSON.stringify(pending)) {
throw new Error(`conflicting committed and pending integration journals for ${agent}; refusing recovery`);
}
unlinkSync(nativePendingJournalPath(agent));
return false;
}
const current = pending.operations.map((operation) => ({ file: operation.file, bytes: fileBytes(operation.file) }));
const restored = pending.operations.map((operation) => {
const before = nativeBackupBytes(operation);
const now = fileBytes(operation.file);
const isInstalled = Boolean(now && bytesHash(now) === operation.after_sha256);
const isBefore = operation.before_exists
? Boolean(now && operation.before_sha256 && bytesHash(now) === operation.before_sha256)
: now === null;
if (!isInstalled && !isBefore) {
throw new Error(`${operation.file} changed during interrupted ${agent} install; refusing recovery`);
}
return { file: operation.file, bytes: before };
});
try {
for (const item of restored) writeNativeRestoration(item.file, item.bytes);
unlinkSync(nativePendingJournalPath(agent));
} catch (error) {
for (const item of current) {
try { writeNativeRestoration(item.file, item.bytes); } catch { /* original error remains authority */ }
}
throw error;
}
process.stderr.write(`${mark("warn")} recovered interrupted ${agent} integration change before continuing\n`);
return true;
}
function nativeMutationsFor(agent: NativeAgent, gw: string, mcpBinary: string | undefined): NativeMutation[] {
return agent === "claude"View on GitHub (pinned to 3ee70a1026)