{"record":{"id":"f43b0ac1c53be0ef","repo":"xai-org/grok-build","slug":"compaction-checkpoint-file-missing-checkpoint-pa","errorCode":null,"errorMessage":"Compaction checkpoint file missing: {checkpoint_path}. Cannot safely rewind past the compaction point.","messagePattern":"Compaction checkpoint file missing: (.+?)\\. Cannot safely rewind past the compaction point\\.","errorType":"error_code","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shell/src/session/helpers/replay.rs","lineNumber":302,"sourceCode":"        info: &CompactionCheckpointInfo,\n        session_dir: &Path,\n    ) -> io::Result<ReplayAction> {\n        if self.target < info.prompt_index_at_compaction {\n            // Target is before this compaction — don't load the compacted\n            // history (we'll reconstruct from raw updates). But the\n            // checkpoint is still required for original_user_info — the\n            // historical User(user_info) that the model saw for these\n            // pre-compaction turns. Without it we'd use the post-compaction\n            // rebuilt user_info, which is wrong data.\n            let checkpoint_path = session_dir.join(&info.checkpoint_file);\n            let bytes = match std::fs::read(&checkpoint_path) {\n                Ok(b) => b,\n                Err(e) if e.kind() == io::ErrorKind::NotFound => {\n                    tracing::error!(\n                        path = %checkpoint_path.display(),\n                        \"Compaction checkpoint file missing, cannot restore original user_info\"\n                    );\n                    return Err(io::Error::new(\n                        io::ErrorKind::NotFound,\n                        format!(\n                            \"Compaction checkpoint file missing: {}. \\\n                             Cannot safely rewind past the compaction point.\",\n                            checkpoint_path.display()\n                        ),\n                    ));\n                }\n                Err(e) => return Err(e),\n            };\n            match serde_json::from_slice::<CompactionCheckpointFile>(&bytes) {\n                Ok(file) => {\n                    if self.original_user_info.is_none() {\n                        self.original_user_info = file.original_user_info;\n                    }\n                }\n                Err(e) => {\n                    tracing::error!(","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shell/src/session/helpers/replay.rs#L284-L320","documentation":"During session replay, when the rewind target is before a compaction point, the replayer must read the compaction checkpoint JSON file to restore the original user_info that the model saw pre-compaction. This io::ErrorKind::NotFound is thrown when the checkpoint file referenced by the compaction record does not exist on disk. Rewinding past that compaction point is unsafe without it, so replay aborts.","triggerScenarios":"Calling rewind/process_update on a session whose update log contains an XaiSessionUpdate::CompactionCheckpoint with target < prompt_index_at_compaction, while session_dir/checkpoint_file has been deleted or never written.","commonSituations":"User manually cleaned the session directory or ran a cleanup/pruning script; checkpoint write was interrupted by crash or power loss; session directory moved or copied incompletely between machines; older tool version wrote compaction records before checkpoint files were introduced.","solutions":["Restore or re-copy the missing checkpoint file named in the message into the session directory","Restore the session directory from backup","Rewind to a target at or after the compaction point instead of before it","Discard the corrupted/lossy session and start a new one"],"exampleFix":"// before: rewinding past compaction with a pruned session dir\nsession.rewind(early_target)?;\n// after: verify checkpoint exists first\nlet ckpt = session_dir.join(&info.checkpoint_file);\nanyhow::ensure!(ckpt.exists(), \"checkpoint missing: {}\", ckpt.display());\nsession.rewind(early_target)?;","handlingStrategy":"validation","validationCode":"let ckpt_path = session_dir.join(&info.checkpoint_file);\nif !ckpt_path.exists() {\n    return Err(anyhow!(\"checkpoint missing, cannot rewind past compaction: {}\", ckpt_path.display()));\n}","typeGuard":null,"tryCatchPattern":"match rewind_result {\n    Err(e) if e.kind() == io::ErrorKind::NotFound && e.to_string().contains(\"checkpoint\") => restore_from_backup_or_rewind_after_compaction(),\n    Err(e) => return Err(e.into()),\n    Ok(()) => {}\n}","preventionTips":["Never manually delete files inside session directories","Exclude checkpoint files from cleanup scripts and sync ignore rules","Copy/rsync session directories with checksums to ensure completeness","Back up session dirs before attempting rewinds"],"tags":["io","filesystem","session-replay","compaction","not-found"],"backgroundTag":"compaction-checkpoint-file-missing","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}