{"record":{"id":"0bdb72663d3ac142","repo":"EpicGames/lore","slug":"file-refused-further-writes-iocp","errorCode":null,"errorMessage":"file refused further writes","messagePattern":"file refused further writes","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"lore-io/src/iocp.rs","lineNumber":447,"sourceCode":"    /// Writes all `len` bytes. See [`Self::read_exact_at`] for why each pass is its own\n    /// submission.\n    pub(crate) async fn write_all_at<B: StableBuf>(\n        &self,\n        file: Arc<File>,\n        buffer: B,\n        len: usize,\n        offset: u64,\n    ) -> std::io::Result<B> {\n        let mut buffer = buffer;\n        let mut done = 0;\n        while done < len {\n            let (payload, result) = self\n                .write(&file, buffer, done, len - done, offset + done as u64)\n                .await;\n            buffer = payload.buffer;\n            match result? {\n                0 => {\n                    return Err(std::io::Error::new(\n                        std::io::ErrorKind::WriteZero,\n                        \"file refused further writes\",\n                    ));\n                }\n                written => done += written,\n            }\n        }\n        Ok(buffer)\n    }\n\n    /// Scatters a read across the segments, one segment per operation.\n    ///\n    /// Windows has no positional scatter/gather call for an ordinary handle — `ReadFileScatter`\n    /// takes page-aligned, sector-sized segments only — so a segment list becomes a sequence of\n    /// operations however it is issued. Issuing them here rather than forwarding to\n    /// [`PsyncDriver`] is what keeps them off the pool: the psync backend walks the segments with\n    /// blocking positional calls inside one dispatch, holding a thread for the whole list.\n    ///","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-io/src/iocp.rs#L429-L465","documentation":"write_all_at could not complete the requested write: the underlying write backend (IOCP) reported zero bytes written at some point mid-loop, so the file accepted no further data. The library surfaces this as ErrorKind::WriteZero rather than silently returning a short write, guaranteeing the caller that the full buffer was either written or the call fails.","triggerScenarios":"Calling write_all_at on a file whose writer end is effectively closed or whose size cannot grow — e.g. writing past a size-capped file, a full/quota-exhausted volume, or a file opened in a mode that truncates or rejects further writes — and the overlapped write operation completes successfully with 0 bytes.","commonSituations":"Disk full or quota exceeded mid-write; the file was truncated/deleted by another process between writes; writing to a special file (pipe, named pipe) that closed; filesystem size limits hit at the offset being written.","solutions":["Check disk space / quota on the target volume and free space or move the file.","Verify the file was not truncated or replaced by another process; reopen and retry the whole write.","Confirm the file is opened for writing at the requested offset and the volume supports files that large.","Retry with a smaller write or use plain filesystem paths rather than special devices."],"exampleFix":"// before\nfile.write_all_at(&buf, offset).await?; // panics/unhandled WriteZero on full disk\n// after\nmatch file.write_all_at(&buf, offset).await {\n    Ok(()) => {}\n    Err(e) if e.kind() == std::io::ErrorKind::WriteZero => {\n        ensure_disk_space(&path)?;\n        file.write_all_at(&buf, offset).await?;\n    }\n    Err(e) => return Err(e),\n}","handlingStrategy":"try-catch","validationCode":"// Rust\nlet free = fs2::available_space(&path)?;\nif free < buf.len() as u64 { return Err(std::io::Error::new(std::io::ErrorKind::StorageFull, \"no space\")); }","typeGuard":null,"tryCatchPattern":"// Rust\nmatch file.write_all_at(&buf, offset).await {\n    Ok(()) => {}\n    Err(e) if e.kind() == std::io::ErrorKind::WriteZero => { /* free space / reopen / retry once */ }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Check free disk space before large writes","Avoid writing to files other processes may truncate; use locking","Write to temp file + rename for durability","Handle ErrorKind::WriteZero explicitly in all write paths"],"tags":["io","filesystem","write"],"backgroundTag":"file-write-failed","analyzedSha":"074eb0b0d1194c997d7cf28b55519e3e197b3e23","analyzedAt":"2026-09-13T09:00:57.509Z","contentChangedAt":"2026-09-13T09:00:57.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}