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

  1. Fix the include pattern's glob syntax (balance brackets, place `**` only as a full path component, use `/` separators)
  2. Test the pattern with the glob crate semantics (e.g. in a small Rust snippet or against glob::Pattern::new) before deploying
  3. Quote or escape special characters (`[`, `]`, `!`) in literal filenames
  4. 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

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


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)