{"record":{"id":"0027d36eff97bc4b","repo":"nautechsystems/nautilus_trader","slug":"record-snapshot-anchor-e","errorCode":null,"errorMessage":"record snapshot anchor: {e}","messagePattern":"record snapshot anchor: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/event_store/src/kernel.rs","lineNumber":359,"sourceCode":"    pub fn high_watermark(&self) -> u64 {\n        self.writer.as_ref().map_or(0, |w| w.high_watermark())\n    }\n\n    /// Returns a snapshot anchorer bound to the open writer.\n    ///\n    /// The execution engine installs this callback while the run is open. The callback\n    /// records the cache-owned snapshot reference against the writer's durable\n    /// high-watermark after flushing earlier captured entries.\n    #[must_use]\n    pub fn snapshot_anchorer(&self) -> Option<SnapshotAnchorer> {\n        let writer = Arc::clone(self.writer.as_ref()?);\n\n        Some(Rc::new(move |snapshot_ref: CacheSnapshotRef| {\n            let content_hash = compute_snapshot_content_hash(snapshot_ref.blob.as_ref());\n            writer\n                .record_snapshot_anchor(snapshot_ref.blob_ref, content_hash)\n                .map(|_| ())\n                .map_err(|e| anyhow::anyhow!(\"record snapshot anchor: {e}\"))\n        }))\n    }\n\n    /// Returns the live bus capture adapter, when one was wired into this run.\n    ///\n    /// `None` after [`Self::close`] consumes the writer.\n    #[must_use]\n    pub fn adapter(&self) -> Option<&Arc<BusCaptureAdapter>> {\n        self.adapter.as_ref()\n    }\n\n    /// Submits the terminal `RunEnded` entry, drains pending entries, and seals the\n    /// manifest as [`RunStatus::Ended`].\n    ///\n    /// Consumes the inner writer; subsequent calls return without effect.\n    ///\n    /// # Errors\n    ///","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/event_store/src/kernel.rs#L341-L377","documentation":"The event-store kernel's snapshot-anchor callback computes a content hash for a cache snapshot and asks the writer to persist the anchor (blob reference + hash); any error from record_snapshot_anchor is wrapped as \"record snapshot anchor: {e}\". This means the durable record linking a snapshot to its content hash could not be written, so the snapshot may be unusable on recovery.","triggerScenarios":"Invoking snapshot_anchorer's callback with a CacheSnapshotRef when the underlying writer fails to record the anchor — e.g. the writer is closed/consumed, the blob reference is invalid, or the backing storage write fails.","commonSituations":"Writing a snapshot after kernel.close() already consumed the writer; disk full or I/O permission problems on the event-store directory; corrupt/unknown blob_ref passed from the cache snapshotter.","solutions":["Inspect the source error inside the wrapper message for the real cause (I/O vs closed writer vs bad blob_ref).","Ensure snapshot_anchorer is only invoked while the kernel/writer is still open (before close()).","Check disk space and write permissions on the event-store storage location.","Retry the snapshot write after verifying the blob reference is valid and the store is healthy."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure the writer is still open before snapshotting\nif kernel.is_closed() {\n    return Err(anyhow::anyhow!(\"cannot record snapshot anchor: writer closed\"));\n}","typeGuard":null,"tryCatchPattern":"match writer.record_snapshot_anchor(blob_ref, hash) {\n    Ok(_) => (),\n    Err(e) => log::error!(\"record snapshot anchor: {e}\"), // inspect inner cause\n}","preventionTips":["Only trigger snapshots before kernel.close() is called.","Monitor disk space and permissions on the event-store directory.","Validate blob references produced by the cache snapshotter."],"tags":["event-store","snapshot","persistence","rust"],"backgroundTag":"file-write-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}