vectordotdev/vector · error

invalid glob patterns

Error message

invalid glob patterns

What it means

The file source's file_source constructor builds a glob-based paths provider over include/exclude patterns and panics with "invalid glob patterns" if any pattern fails to compile as a glob. This is a configuration error surfaced as a panic during source build.

Solutions

  1. Fix the include/exclude glob patterns to valid glob syntax (e.g. /var/log/**/*.log).
  2. Test each pattern with a glob validator (or glob::Pattern::new) before deploying.
  3. Quote patterns in YAML so special characters aren't mangled, and ensure wildcards are glob-style, not regex.

Example fix

# before
include:
  - "/var/log/[app/*.log"
# after
include:
  - "/var/log/app/*.log"
Defensive patterns

Strategy: validation

Validate before calling

for p in include.iter().chain(exclude.iter()) {
    if glob::Pattern::new(p).is_err() {
        eprintln!("invalid glob pattern: {}", p);
    }
}

Prevention

When it happens

Trigger: Configuring a file source whose `include` or `exclude` entries contain malformed glob syntax (e.g. unmatched `[`, invalid `**` placement) so glob::Pattern::new fails when Glob::new iterates them.

Common situations: YAML quoting issues leaving raw brackets in patterns; users writing regex-style patterns (e.g. ".*\\.log$") instead of globs; templated paths substituting empty or broken values.

Related errors


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

Appendix: source

Thrown at src/sources/file.rs:513

    let ignore_before = calculate_ignore_before(config.ignore_older_secs);
    let glob_minimum_cooldown = config.glob_minimum_cooldown_ms;
    let (ignore_checkpoints, read_from) = reconcile_position_options(
        config.start_at_beginning,
        config.ignore_checkpoints,
        Some(config.read_from),
    );

    let emitter = FileSourceInternalEventsEmitter {
        include_file_metric_tag: config.internal_metrics.include_file_tag,
    };

    let paths_provider = Glob::new(
        &config.include,
        &exclude_patterns,
        MatchOptions::default(),
        emitter.clone(),
    )
    .expect("invalid glob patterns");

    let encoding_charset = config.encoding.clone().map(|e| e.charset);

    // if file encoding is specified, need to convert the line delimiter (present as utf8)
    // to the specified encoding, so that delimiter-based line splitting can work properly
    let line_delimiter_as_bytes = match encoding_charset {
        Some(e) => Encoder::new(e).encode_from_utf8(&config.line_delimiter),
        None => Bytes::from(config.line_delimiter.clone()),
    };

    let checkpointer = Checkpointer::new(&data_dir);
    let strategy = config.fingerprint.clone().into();

    let file_server = FileServer {
        paths_provider,
        max_read_bytes: config.max_read_bytes,
        ignore_checkpoints,
        read_from,

View on GitHub (pinned to bdb87aeaa4)