{"record":{"id":"b46b6a9a2ec17587","repo":"vectordotdev/vector","slug":"failed-to-read-glob-pattern","errorCode":null,"errorMessage":"failed to read glob pattern","messagePattern":"failed to read glob pattern","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/file-source/src/paths_provider.rs","lineNumber":82,"sourceCode":"\n        Some(Self {\n            include_patterns,\n            exclude_patterns,\n            glob_match_options,\n            emitter,\n        })\n    }\n}\n\nimpl<E: FileSourceInternalEvents> PathsProvider for Glob<E> {\n    type IntoIter = Vec<PathBuf>;\n\n    fn paths(&self) -> Self::IntoIter {\n        self.include_patterns\n            .iter()\n            .flat_map(|include_pattern| {\n                glob::glob_with(include_pattern.as_str(), self.glob_match_options)\n                    .expect(\"failed to read glob pattern\")\n                    .filter_map(|val| {\n                        val.map_err(|error| {\n                            self.emitter\n                                .emit_path_globbing_failed(error.path(), error.error())\n                        })\n                        .ok()\n                    })\n            })\n            .filter(|candidate_path: &PathBuf| -> bool {\n                !self.exclude_patterns.iter().any(|exclude_pattern| {\n                    let candidate_path_str = candidate_path.to_str().unwrap();\n                    exclude_pattern.matches(candidate_path_str)\n                })\n            })\n            .collect()\n    }\n}\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/file-source/src/paths_provider.rs#L64-L100","documentation":"Vector's file source expands every `include` glob with `glob::glob_with` and treats a malformed pattern as unrecoverable, panicking with 'failed to read glob pattern'. The glob crate returns a PatternError when the pattern violates its syntax, such as an unbalanced `[` or `{`, an inverted character range like `[z-a]`, or a trailing backslash. The panic fires when the Glob paths provider first resolves paths, i.e. when the file source starts or reloads, and it tears down the whole topology.","triggerScenarios":"Setting `include` (or a component feeding Glob::new) to a syntactically invalid glob such as \"/var/log/app/[0-9\", \"[z-a].log\", or \"{a,b\" and then starting Vector or reloading config; paths_provider.rs calls glob_with(...).expect(...) for every include pattern on each paths() call.","commonSituations":"Typo'd log path patterns in file source config; copying bash extglob or regex syntax (e.g. unescaped brackets) into a glob field; config templating (Helm/Jinja) that emits an unterminated bracket for empty values; paths that literally contain `[` which must be escaped as `\\[` in glob syntax.","solutions":["Fix the pattern syntax: close every [ ... ] and { ... }, use ascending ranges like [a-z], and escape literal brackets as \\[","If the literal filename contains [ or {, replace it with a * or ? wildcard instead of escaping","Add a pre-deploy check that runs glob::Pattern::new (or glob::glob_with with the same match options) over every include/exclude pattern, since `vector validate` only checks config shape and may not compile the glob"],"exampleFix":"# before (panics at startup)\n[sources.in]\ntype = \"file\"\ninclude = [\"/var/log/app/[0-9\"]\n\n# after\n[sources.in]\ntype = \"file\"\ninclude = [\"/var/log/app/[0-9]*\"]","handlingStrategy":"validation","validationCode":"fn validate_globs(patterns: &[String]) -> Result<(), String> {\n    for p in patterns {\n        if glob::Pattern::new(p).is_err() {\n            return Err(format!(\"invalid glob pattern: {p}\"));\n        }\n    }\n    Ok(())\n}\n\n// run before applying/starting the file source config\nvalidate_globs(&config.include)?;","typeGuard":"fn is_valid_glob(pattern: &str) -> bool {\n    glob::Pattern::new(pattern).is_ok()\n}","tryCatchPattern":null,"preventionTips":["Lint include/exclude patterns in CI with glob::Pattern::new before config ships","Remember `vector validate` checks config shape, not glob compilation — add an explicit smoke run of the file source in staging","Escape literal [ and { as \\[ and \\{ in glob fields; prefer wildcards over literals"],"tags":["rust","vector","file-source","glob","config","panic"],"backgroundTag":"invalid-glob-pattern","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}