{"record":{"id":"f720ec0d27706a5c","repo":"vectordotdev/vector","slug":"unexpectedeof","errorCode":"UnexpectedEof","errorMessage":"EOF reached","messagePattern":"EOF reached","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"lib/file-source-common/src/fingerprinter.rs","lineNumber":256,"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                } else {\n                    count -= 1;\n                }\n            }\n        }\n        total_read += read;\n        buf = &mut buf[read..];\n    }","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/file-source-common/src/fingerprinter.rs#L238-L274","documentation":"The file source's fingerprinter reads the first N lines (up to `fingerprint.lines`, after `ignored_header_bytes`) of a file to compute its identity checksum, using `fingerprinter_read_until` to fill a fixed buffer. A read returning `Ok(0)` before the buffer is full means end-of-file was hit prematurely, and it is surfaced as `UnexpectedEof` (\"EOF reached\"). This typically means the file is too short for the configured fingerprint window (including gzip inputs whose decompressed head is smaller than needed).","triggerScenarios":"A globbed file smaller than the fingerprint buffer/line requirement — e.g. `fingerprint.lines = 1` on an empty file being written, or higher `lines` on a file with fewer lines; files with more `ignored_header_bytes` than actual content; a gzip member header that decompresses to fewer bytes than requested.","commonSituations":"Log rotation leaving zero-byte or one-line stub files matched by the glob; setting `fingerprint.lines` > 1 (as some guides suggest to survive identical first lines) on directories with short files; ignoring header bytes of files without those headers.","solutions":["Keep `fingerprint.lines` at 1 (default) unless every matched file is guaranteed longer.","Tighten the glob (`exclude_files`, or match `*.log` only) so transient empty/partial files being written are not fingerprinted.","If identical first lines across files force a bigger window, ensure `fingerprint.lines` stays below the smallest real file's line count, or switch `fingerprint.strategy` to `devino` (inode-based, no content read).","Verify `ignored_header_bytes` is smaller than the files being matched."],"exampleFix":"# before\nsources:\n  logs:\n    type: file\n    include: [\"/var/log/app/*\"]\n    fingerprint:\n      lines: 5\n# short files (<5 lines) hit UnexpectedEof\n\n# after\nsources:\n  logs:\n    type: file\n    include: [\"/var/log/app/*.log\"]\n    fingerprint:\n      lines: 1","handlingStrategy":"validation","validationCode":"# Config-side: keep fingerprint window within the smallest file\nfingerprint:\n  strategy: checksum\n  lines: 1\n  ignored_header_bytes: 0\n\n# Deploy-time: fail if any matched file is smaller than the window\nfind /var/log/app -name '*.log' -size -1k -print -quit | grep -q . && \\\n  echo 'WARN: files smaller than fingerprint window matched by glob'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use tight globs and exclude_files for transient/empty files.","Keep fingerprint.lines = 1 unless every matched file is provably longer.","If unavoidable, switch to fingerprint.strategy = \"devino\" (no content read, at the cost of identity surviving inode reuse poorly on some filesystems)."],"tags":["file-source","fingerprint","eof","vector"],"backgroundTag":"unexpected-eof","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}