{"record":{"id":"03b7ce1a2a5a8bfd","repo":"getzola/zola","slug":"invalid-name-glob-pattern-pat-error-e","errorCode":null,"errorMessage":"Invalid {name} glob pattern: {pat}, error = {e}","messagePattern":"Invalid (.+?) glob pattern: (.+?), error = (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"components/utils/src/globs.rs","lineNumber":15,"sourceCode":"use globset::{Glob, GlobSet, GlobSetBuilder};\n\nuse errors::{Result, bail};\n\npub fn build_ignore_glob_set(ignore: &Vec<String>, name: &str) -> Result<GlobSet> {\n    // Convert the file glob strings into a compiled glob set matcher. We want to do this once,\n    // at program initialization, rather than for every page, for example. We arrange for the\n    // globset matcher to always exist (even though it has to be inside an Option at the\n    // moment because of the TOML serializer); if the glob set is empty the `is_match` function\n    // of the globber always returns false.\n    let mut glob_set_builder = GlobSetBuilder::new();\n    for pat in ignore {\n        let glob = match Glob::new(pat) {\n            Ok(g) => g,\n            Err(e) => bail!(\"Invalid {name} glob pattern: {pat}, error = {e}\"),\n        };\n        glob_set_builder.add(glob);\n    }\n    Ok(glob_set_builder.build()?)\n}\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/getzola/zola/blob/61d30828217957120309db657950224edf9707e2/components/utils/src/globs.rs#L1-L21","documentation":"`build_ignore_glob_set` builds a `GlobSet` from user-supplied glob patterns. Each pattern is compiled with `Glob::new`; on failure it bails with the pattern and the underlying globset error. Malformed globs (unbalanced brackets, invalid syntax) cannot be compiled.","triggerScenarios":"Passing an invalid glob string to the ignored-files/ignored-content configuration (e.g. `[extra]` or `[build]` ignore settings) such as `\"**[\"` or an unclosed `{}`, parsed via `parse`/`resolve_globset`.","commonSituations":"Typos in config.toml glob patterns; copying shell-style globs unsupported by the globset syntax; quotes/escaping issues in TOML.","solutions":["Fix the glob pattern named in the error to valid globset syntax","Test the pattern syntax (e.g. balanced `[]`, `{}`, `*`/`**` usage)","Simplify to a plain filename or prefix pattern if advanced syntax isn't needed"],"exampleFix":"// before\nignored_content = [\"**[\"]\n// after\nignored_content = [\"**/drafts/**\"]","handlingStrategy":"validation","validationCode":"fn globs_valid(pats: &[String]) -> bool {\n    pats.iter().all(|p| globset::Glob::new(p).is_ok())\n}","typeGuard":null,"tryCatchPattern":"match build_ignore_glob_set(&pats, \"ignored_content\") {\n    Ok(gs) => use(gs),\n    Err(e) if e.to_string().contains(\"Invalid\") && e.to_string().contains(\"glob pattern\") => {\n        eprintln!(\"check the pattern named in: {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate glob syntax in CI before building","Prefer simple patterns (literal names, ** suffixes) over exotic syntax","Remember globset syntax differs from shell globs (no extglob)"],"tags":["rust","glob","configuration","globset"],"backgroundTag":"invalid-glob-pattern","analyzedSha":"61d30828217957120309db657950224edf9707e2","analyzedAt":"2026-09-03T14:39:09.727Z","contentChangedAt":"2026-09-03T14:39:09.727Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}