vectordotdev/vector · error
file server exited with an error
Error message
file server exited with an error
What it means
The file source drives its file server on a blocking thread: rt.block_on(file_server.run(...)) followed by result.expect("file server exited with an error"). FileServer::run returns Err only for errors it treats as terminal rather than per-file logging. The panic is contained by design: spawn_blocking turns it into a JoinHandle error and the surrounding .map_err logs "File server unexpectedly stopped." - but the source task then ends, so log collection stops while the process may keep running.
Source
Thrown at src/sources/file.rs:695
}
Err(_) => {
let (count, _) = messages.size_hint();
emit!(StreamClosedError { count });
}
}
});
let span = info_span!("file_server");
tokio::task::spawn_blocking(move || {
let _enter = span.enter();
let rt = tokio::runtime::Handle::current();
let result =
rt.block_on(file_server.run(tx, shutdown, shutdown_checkpointer, checkpointer));
emit!(FileOpen { count: 0 });
// Panic if we encounter any error originating from the file server.
// We're at the `spawn_blocking` call, the panic will be caught and
// passed to the `JoinHandle` error, similar to the usual threads.
result.expect("file server exited with an error");
})
.map_err(|error| error!(message="File server unexpectedly stopped.", %error, internal_log_rate_limit = false))
.await
})
}
/// Emit deprecation warning if the old option is used, and take it into account when determining
/// defaults. Any of the newer options will override it when set directly.
fn reconcile_position_options(
start_at_beginning: Option<bool>,
ignore_checkpoints: Option<bool>,
read_from: Option<ReadFromConfig>,
) -> (bool, ReadFrom) {
if start_at_beginning.is_some() {
warn!(
message = "Use of deprecated option `start_at_beginning`. Please use `ignore_checkpoints` and `read_from` options instead."
)
}View on GitHub (pinned to 3708c39b12)
Solutions
- Grep Vector logs for the error immediately preceding 'File server unexpectedly stopped.' and fix that root cause
- Check data_dir writability, disk space, and checkpoint file ownership (common after user/permission changes)
- Do not share data_dir/checkpoint files between multiple file sources or Vector instances
- Patch: replace result.expect(...) with an explicit error log and clean source shutdown; upgrade Vector
Example fix
// before
result.expect("file server exited with an error");
// after
if let Err(error) = result {
error!(message = "file server exited with an error", %error, internal_log_rate_limit = false);
} Defensive patterns
Strategy: try-catch
Validate before calling
// preflight before starting the file source:
let probe = config.data_dir.join(".vector_probe");
std::fs::write(&probe, b"").context(WriteProbeSnafu)?;
std::fs::remove_file(&probe).ok();
// also verify checkpoint file ownership/permissions if it exists Try / catch
// handle the JoinHandle outcome instead of letting the panic vanish into a log line:
if let Err(join_error) = tokio::task::spawn_blocking(move || {
// ... rt.block_on(file_server.run(...)) -> handle Err explicitly
}).await
{
error!(message = "File server unexpectedly stopped.", %join_error);
// surface source failure to the supervisor / trigger restart
} Prevention
- Monitor Vector logs for 'File server unexpectedly stopped.' and alert on it, since the process may keep running with a dead file source
- Keep data_dir on reliable local storage; avoid NFS for checkpoints
- Do not share data_dir between file sources or Vector instances
- Watch disk space and permissions on data_dir, especially after user changes
When it happens
Trigger: Any terminal error out of FileServer::run while tailing files - unrecoverable internal failures of the run loop rather than ordinary file read problems; the root-cause error is logged just before this panic.
Common situations: data_dir or checkpoint state becoming unwritable (permission changes, disk full, NFS flaps), sharing one data_dir between file sources or instances, or a version regression in the file server run loop.
Related errors
- failed to read glob pattern
- not a valid path
- path and query should never fail to parse
- Serializer does not support JSON
- Paths must always start with a leading forward slash (`/`).
AI-assisted analysis of vectordotdev/vector@3708c39b12 (2026-08-20).
Data as JSON: /api/errors/9dadeb277ef1176b.
Report an issue: GitHub.