{"record":{"id":"2ac2c20bd83987de","repo":"toeverything/AFFiNE","slug":"unexpectedeof","errorCode":"UnexpectedEof","errorMessage":"unexpected end of OneNote file","messagePattern":"unexpected end of OneNote file","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/native/src/import/onenote/windows_fs.rs","lineNumber":122,"sourceCode":"struct WindowsFileSource {\n  file: File,\n  byte_length: u64,\n}\n\nimpl FileSource for WindowsFileSource {\n  fn byte_length(&self) -> u64 {\n    self.byte_length\n  }\n\n  fn read_at(&self, offset: u64, len: usize) -> Result<Bytes, Error> {\n    use std::os::windows::fs::FileExt;\n\n    let mut bytes = vec![0; len];\n    let mut read = 0;\n    while read < len {\n      let count = self.file.seek_read(&mut bytes[read..], offset + read as u64)?;\n      if count == 0 {\n        return Err(Error::new(\n          std::io::ErrorKind::UnexpectedEof,\n          \"unexpected end of OneNote file\",\n        ));\n      }\n      read += count;\n    }\n    Ok(Bytes::from(bytes))\n  }\n}\n\n#[cfg(test)]\nmod tests {\n  use super::*;\n\n  #[test]\n  fn preserves_windows_absolute_path_prefixes() {\n    assert_eq!(\n      resolve_path(TypedPath::derive(r\"C:\\Users\\Alice\\Notebook.one\")).unwrap(),","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/native/src/import/onenote/windows_fs.rs#L104-L140","documentation":"Raised in `read_at` of the Windows FileSource impl when `seek_read` returns 0 bytes before the requested length has been filled — the file ended before `offset + len`, so the OneNote file is shorter than its recorded byte_length or the offset is out of bounds. The parser treats a truncated or misaligned OneNote file as unreadable and aborts reading at that point.","triggerScenarios":"Raised by WindowsFileSource::read_at when a seek_read returns zero bytes before the requested length is filled, i.e. the file ended early.","commonSituations":"The OneNote file is truncated or was modified during import. Re-export or copy the file and retry the import.","solutions":["Provide a complete, non-truncated OneNote file.","Re-copy or re-download the file and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}