{"record":{"id":"945ee81e3ac944cd","repo":"tursodatabase/turso","slug":"has-hole-is-not-supported-for-the-given-io-impleme","errorCode":null,"errorMessage":"has_hole is not supported for the given IO implementation","messagePattern":"has_hole is not supported for the given IO implementation","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/io/mod.rs","lineNumber":209,"sourceCode":"            if let Err(e) = self.pwrite(pos, buf.clone(), child_c) {\n                c.abort();\n                return Err(e);\n            }\n            pos += len as u64;\n        }\n        Ok(c)\n    }\n    fn size(&self) -> Result<u64>;\n    fn truncate(&self, len: u64, c: Completion) -> Result<Completion>;\n\n    /// Optional method implemented by the IO which supports \"partial\" files (e.g. file with \"holes\")\n    /// This method is used in sync engine only for now (in partial sync mode) and never used in the core database code\n    ///\n    /// The hole is the contiguous file region which is not allocated by the file-system\n    /// If there is a single byte which is allocated within a given range - method must return false in this case\n    // todo: need to add custom completion type?\n    fn has_hole(&self, _pos: usize, _len: usize) -> Result<bool> {\n        panic!(\"has_hole is not supported for the given IO implementation\")\n    }\n    /// Optional method implemented by the IO which supports \"partial\" files (e.g. file with \"holes\")\n    /// This method is used in sync engine only for now (in partial sync mode) and never used in the core database code\n    // todo: need to add custom completion type?\n    fn punch_hole(&self, _pos: usize, _len: usize) -> Result<()> {\n        panic!(\"punch_hole is not supported for the given IO implementation\")\n    }\n\n    fn shared_wal_lock_byte(\n        &self,\n        _offset: u64,\n        _exclusive: bool,\n        _kind: SharedWalLockKind,\n    ) -> Result<()> {\n        Err(crate::LimboError::InternalError(\n            \"shared WAL coordination byte locking is not supported for this file\".into(),\n        ))\n    }","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/tursodatabase/turso/blob/6c7252267988c76e632af00a671e4b9788dfae13/core/io/mod.rs#L191-L227","documentation":"has_hole() is an optional method on the IO trait whose default implementation panics. Only IO backends implementing sparse-file semantics can answer it; the sync engine uses it in partial-sync mode and core database code never calls it. Invoking it on a backend that did not override it crashes.","triggerScenarios":"Enabling partial sync against an IO implementation that does not implement has_hole/punch_hole: in-memory IO, custom test IO backends, or platform variants without sparse-file support.","commonSituations":"Pointing the sync engine at a memory database in tests; shipping custom IO backends; filesystems lacking hole reporting (some network filesystems).","solutions":["Use the file-backed platform IO (which implements hole queries) for partial sync","Disable partial-sync mode and use full sync","For custom IO: implement has_hole()/punch_hole() backed by SEEK_HOLE/fiemap or an allocation map"],"exampleFix":"// before\n// partial sync over an IO without hole support -> panics in has_hole\nengine.enable_partial_sync(memory_io);\n\n// after\n// use the file-backed platform IO that implements sparse-file queries\nengine.enable_partial_sync(platform_file_io);","handlingStrategy":"fallback","validationCode":"// enable partial sync only for IO backends known to implement hole queries\nfn io_supports_holes(io: &std::sync::Arc<dyn IO>) -> bool {\n    // match the concrete file-backed PlatformIO types you ship\n    matches_downcast_to_platform_file_io(io)\n}\nif !io_supports_holes(&io) { engine.use_full_sync(); } else { engine.enable_partial_sync(io); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat has_hole/punch_hole as capabilities: enable partial sync only on file-backed IO on ext4/xfs/btrfs","Add a per-backend integration test that exercises partial sync before shipping a custom IO"],"tags":["io","sync","sparse-files","trait-default-panic","panic"],"backgroundTag":"unsupported-io-operation","analyzedSha":"6c7252267988c76e632af00a671e4b9788dfae13","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}