vectordotdev/vector · error

EOF reached

Error message

EOF reached

What it means

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.

Solutions

  1. Exclude empty/tiny files from the watched directory or delete them.
  2. Lower the fingerprint line/byte requirement if you must track small files, or switch to a fingerprint strategy suited to small files.
  3. Ignore the error for files still being written and re-fingerprint once complete.

Example fix

// before (vector.yaml)
sources:
  files:
    type: file
    fingerprint:
      lines: 5   // fails for files with <5 lines
// after
sources:
  files:
    type: file
    fingerprint:
      lines: 1
Defensive patterns

Strategy: try-catch

Validate before calling

// skip files too small to fingerprint
fn fingerprintable(path: &Path, min_bytes: u64) -> bool {
    std::fs::metadata(path).map(|m| m.len() >= min_bytes).unwrap_or(false)
}

Try / catch

match fingerprinter.fingerprint(path).await {
    Err(e) if e.kind() == ErrorKind::UnexpectedEof => {
        // file too small/short: skip until it grows
        Ok(None)
    }
    other => other.map(Some),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of vectordotdev/vector@0d4ab78a4f (2026-09-16). Data as JSON: /api/errors/bc9793690742b137. Report an issue: GitHub.

Appendix: source

Thrown at lib/file-source-common/src/fingerprinter.rs:257

                }
                // For scenarios other than UnexpectedEOF, remove the path from the small files map.
                known_small_files.remove(&path.to_path_buf());
            })
            .ok()
            .flatten()
    }
}

async fn fingerprinter_read_until(
    mut r: impl AsyncRead + Unpin + Send,
    delim: u8,
    mut count: usize,
    mut buf: &mut [u8],
) -> Result<usize> {
    let mut total_read = 0;
    'main: while !buf.is_empty() {
        let read = match r.read(buf).await {
            Ok(0) => return Err(std::io::Error::new(ErrorKind::UnexpectedEof, "EOF reached")),
            Ok(n) => n,
            Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,
            Err(e) => return Err(e),
        };

        for (pos, &c) in buf[..read].iter().enumerate() {
            if c == delim {
                if count <= 1 {
                    total_read += pos + 1;
                    break 'main;
                }
                count -= 1;
            }
        }
        total_read += read;
        buf = &mut buf[read..];
    }
    Ok(total_read)

View on GitHub (pinned to 0d4ab78a4f)