vectordotdev/vector · error

No ability to glob

Error message

No ability to glob

What it means

`process_paths` converts each config path (possibly a glob pattern) to `&str` for the `glob` crate. A `PathBuf` that is not valid UTF-8 makes `to_str()` return None, so the expect panics with "No ability to glob". The glob crate requires string patterns.

Solutions

  1. Rename the config file/path so it contains only valid UTF-8 characters.
  2. Pass the path with proper encoding, e.g. quote it in the shell rather than embedding raw bytes.
  3. Check `locale` settings if filenames appear garbled in your environment.

Example fix

// before
vector --config $'bad\xffname.yaml'   // panics: No ability to glob
// after
mv $'bad\xffname.yaml' badname.yaml && vector --config badname.yaml
Defensive patterns

Strategy: validation

Validate before calling

if path.to_str().is_none() {
    eprintln!("config path is not valid UTF-8: {:?}", path);
    std::process::exit(2);
}

Type guard

fn is_utf8_path(p: &std::path::Path) -> bool { p.to_str().is_some() }

Try / catch

match std::fs::read_to_string(&path) { Err(_) => eprintln!("cannot read config path {:?} — is it valid UTF-8?", path), Ok(_) => {} }

Prevention

When it happens

Trigger: Passing a config path containing non-UTF-8 bytes (e.g. `-c` argument built from raw OS bytes) to `process_paths`.

Common situations: Config filenames created with unusual encodings or control characters; paths supplied programmatically from `OsString` values on systems with non-UTF-8 locales.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at src/config/loading/mod.rs:105

        .into_iter()
        .flat_map(|(paths, format)| paths.iter().cloned().map(move |path| (path, format)))
}

/// Expand a list of paths (potentially containing glob patterns) into real
/// config paths, replacing it with the default paths when empty.
pub fn process_paths(config_paths: &[ConfigPath]) -> Option<Vec<ConfigPath>> {
    let starting_paths = if !config_paths.is_empty() {
        config_paths.to_owned()
    } else {
        default_config_paths()
    };

    let mut paths = Vec::new();

    for config_path in &starting_paths {
        let config_pattern: &PathBuf = config_path.into();

        let matches: Vec<PathBuf> = match glob(config_pattern.to_str().expect("No ability to glob"))
        {
            Ok(glob_paths) => glob_paths.filter_map(Result::ok).collect(),
            Err(err) => {
                error!(message = "Failed to read glob pattern.", path = ?config_pattern, error = ?err);
                return None;
            }
        };

        if matches.is_empty() {
            error!(message = "Config file not found in path.", path = ?config_pattern, internal_log_rate_limit = false);
            std::process::exit(exitcode::CONFIG);
        }

        match config_path {
            ConfigPath::File(_, format) => {
                for path in matches {
                    paths.push(ConfigPath::File(path, *format));
                }

View on GitHub (pinned to 0d4ab78a4f)