{"record":{"id":"bc9793690742b137","repo":"vectordotdev/vector","slug":"eof-reached","errorCode":null,"errorMessage":"EOF reached","messagePattern":"EOF reached","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/file-source-common/src/fingerprinter.rs","lineNumber":257,"sourceCode":"                }\n                // For scenarios other than UnexpectedEOF, remove the path from the small files map.\n                known_small_files.remove(&path.to_path_buf());\n            })\n            .ok()\n            .flatten()\n    }\n}\n\nasync fn fingerprinter_read_until(\n    mut r: impl AsyncRead + Unpin + Send,\n    delim: u8,\n    mut count: usize,\n    mut buf: &mut [u8],\n) -> Result<usize> {\n    let mut total_read = 0;\n    'main: while !buf.is_empty() {\n        let read = match r.read(buf).await {\n            Ok(0) => return Err(std::io::Error::new(ErrorKind::UnexpectedEof, \"EOF reached\")),\n            Ok(n) => n,\n            Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,\n            Err(e) => return Err(e),\n        };\n\n        for (pos, &c) in buf[..read].iter().enumerate() {\n            if c == delim {\n                if count <= 1 {\n                    total_read += pos + 1;\n                    break 'main;\n                }\n                count -= 1;\n            }\n        }\n        total_read += read;\n        buf = &mut buf[read..];\n    }\n    Ok(total_read)","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/vectordotdev/vector/blob/0d4ab78a4f0d9c9e5d03a50108a2ae4d2f4b2460/lib/file-source-common/src/fingerprinter.rs#L239-L275","documentation":"The file fingerprinter reads the first N bytes of a file to compute a fingerprint for identity tracking. This error is raised when the reader returns 0 bytes (EOF) before the required fingerprint length was fully read, i.e. the file is shorter than the fingerprint size. The fingerprint cannot be computed, so an UnexpectedEof io error is returned.","triggerScenarios":"Fingerprinting a file smaller than the configured fingerprint line/byte size (e.g. an empty file or a file with a single very short line when fingerprinting by first line); using fingerprint.lines larger than files typically contain.","commonSituations":"Empty or tiny files appearing in a watched directory; misconfigured fingerprint strategy (e.g. checksum on a file smaller than the checksum length) after changing the fingerprint config; files still being created/truncated.","solutions":["Exclude empty/tiny files from the watched directory or delete them.","Lower the fingerprint line/byte requirement if you must track small files, or switch to a fingerprint strategy suited to small files.","Ignore the error for files still being written and re-fingerprint once complete."],"exampleFix":"// before (vector.yaml)\nsources:\n  files:\n    type: file\n    fingerprint:\n      lines: 5   // fails for files with <5 lines\n// after\nsources:\n  files:\n    type: file\n    fingerprint:\n      lines: 1","handlingStrategy":"try-catch","validationCode":"// skip files too small to fingerprint\nfn fingerprintable(path: &Path, min_bytes: u64) -> bool {\n    std::fs::metadata(path).map(|m| m.len() >= min_bytes).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match fingerprinter.fingerprint(path).await {\n    Err(e) if e.kind() == ErrorKind::UnexpectedEof => {\n        // file too small/short: skip until it grows\n        Ok(None)\n    }\n    other => other.map(Some),\n}","preventionTips":["Set fingerprint.lines to a value smaller than the smallest expected file's line count.","Exclude staging directories where files are still being written.","Clean up empty files from watched directories."],"tags":["file-source","fingerprint","io","eof"],"backgroundTag":"unexpected-eof","analyzedSha":"0d4ab78a4f0d9c9e5d03a50108a2ae4d2f4b2460","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}