vectordotdev/vector · critical
failed to read glob pattern
Error message
failed to read glob pattern
What it means
`FileServer`/paths provider's `paths()` calls `glob::glob_with` on each configured include pattern and `.expect`s success. The `glob` crate panics via this expect only when the pattern itself is invalid syntax (it returns Result solely for invalid patterns); per-entry errors are already handled downstream via the emitter. So this panic means a syntactically invalid glob was configured.
Solutions
- Fix the include pattern's glob syntax (balance brackets, place `**` only as a full path component, use `/` separators)
- Test the pattern with the glob crate semantics (e.g. in a small Rust snippet or against glob::Pattern::new) before deploying
- Quote or escape special characters (`[`, `]`, `!`) in literal filenames
- Check Vector startup logs for the offending pattern and correct it in the config
Example fix
// before include = ["/var/log/[logs]/*.log"] # unbalanced/invalid class usage // after include = ["/var/log/**/*.log"]
Defensive patterns
Strategy: validation
Validate before calling
// validate include patterns before configuring the file source
fn valid_glob(p: &str) -> bool {
glob::Pattern::new(p).is_ok()
} Prevention
- Test globs against glob::Pattern before deploying config
- Balance bracket expressions and keep `**` as full components
- Use forward slashes in patterns on all platforms
When it happens
Trigger: Starting a file source whose `include` contains a malformed glob pattern (e.g. unbalanced `[`, invalid use of `**` beyond position rules, or a non-UTF8 pattern) so `glob_with` returns Err before iteration begins.
Common situations: Typo in a Vector `sources.file.include` glob like `[/var/log/**` or `[!.]*.log` mistakes; patterns copied from shell syntax that the glob crate rejects; platform-specific path separators in patterns.
Related errors
- invalid glob patterns
- file server exited with an error
- file server exited with an error
- global log_schema.message_key to be valid path
- Integration has no environments
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/b46b6a9a2ec17587.
Report an issue: GitHub.
Appendix: source
Thrown at lib/file-source/src/paths_provider.rs:82
Some(Self {
include_patterns,
exclude_patterns,
glob_match_options,
emitter,
})
}
}
impl<E: FileSourceInternalEvents> PathsProvider for Glob<E> {
type IntoIter = Vec<PathBuf>;
fn paths(&self) -> Self::IntoIter {
self.include_patterns
.iter()
.flat_map(|include_pattern| {
glob::glob_with(include_pattern.as_str(), self.glob_match_options)
.expect("failed to read glob pattern")
.filter_map(|val| {
val.map_err(|error| {
self.emitter
.emit_path_globbing_failed(error.path(), error.error())
})
.ok()
})
})
.filter(|candidate_path: &PathBuf| -> bool {
!self.exclude_patterns.iter().any(|exclude_pattern| {
let candidate_path_str = candidate_path.to_str().unwrap();
exclude_pattern.matches(candidate_path_str)
})
})
.collect()
}
}
View on GitHub (pinned to bdb87aeaa4)