{"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":"critical","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/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/lib/file-source/src/paths_provider.rs#L64-L100","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ninclude = [\"/var/log/[logs]/*.log\"]  # unbalanced/invalid class usage\n// after\ninclude = [\"/var/log/**/*.log\"]","handlingStrategy":"validation","validationCode":"// validate include patterns before configuring the file source\nfn valid_glob(p: &str) -> bool {\n    glob::Pattern::new(p).is_ok()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test globs against glob::Pattern before deploying config","Balance bracket expressions and keep `**` as full components","Use forward slashes in patterns on all platforms"],"tags":["glob","file-source","panic","configuration"],"backgroundTag":"invalid-glob-pattern","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}