toeverything/AFFiNE · error · std::io::Error
UnexpectedEof
UnexpectedEof
Error message
unexpected end of OneNote file
What it means
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.
Source
Thrown at packages/frontend/native/src/import/onenote/windows_fs.rs:122
struct WindowsFileSource {
file: File,
byte_length: u64,
}
impl FileSource for WindowsFileSource {
fn byte_length(&self) -> u64 {
self.byte_length
}
fn read_at(&self, offset: u64, len: usize) -> Result<Bytes, Error> {
use std::os::windows::fs::FileExt;
let mut bytes = vec![0; len];
let mut read = 0;
while read < len {
let count = self.file.seek_read(&mut bytes[read..], offset + read as u64)?;
if count == 0 {
return Err(Error::new(
std::io::ErrorKind::UnexpectedEof,
"unexpected end of OneNote file",
));
}
read += count;
}
Ok(Bytes::from(bytes))
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn preserves_windows_absolute_path_prefixes() {
assert_eq!(
resolve_path(TypedPath::derive(r"C:\Users\Alice\Notebook.one")).unwrap(),View on GitHub (pinned to b4c8548c09)
Solutions
- Provide a complete, non-truncated OneNote file.
- Re-copy or re-download the file and retry.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Raised by WindowsFileSource::read_at when a seek_read returns zero bytes before the requested length is filled, i.e. the file ended early.
Common situations: The OneNote file is truncated or was modified during import. Re-export or copy the file and retry the import.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/2ac2c20bd83987de.
Report an issue: GitHub.