getzola/zola · error
Invalid {name} glob pattern: {pat}, error = {e}
Error message
Invalid {name} glob pattern: {pat}, error = {e} What it means
`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.
Source
Thrown at components/utils/src/globs.rs:15
use globset::{Glob, GlobSet, GlobSetBuilder};
use errors::{Result, bail};
pub fn build_ignore_glob_set(ignore: &Vec<String>, name: &str) -> Result<GlobSet> {
// Convert the file glob strings into a compiled glob set matcher. We want to do this once,
// at program initialization, rather than for every page, for example. We arrange for the
// globset matcher to always exist (even though it has to be inside an Option at the
// moment because of the TOML serializer); if the glob set is empty the `is_match` function
// of the globber always returns false.
let mut glob_set_builder = GlobSetBuilder::new();
for pat in ignore {
let glob = match Glob::new(pat) {
Ok(g) => g,
Err(e) => bail!("Invalid {name} glob pattern: {pat}, error = {e}"),
};
glob_set_builder.add(glob);
}
Ok(glob_set_builder.build()?)
}
View on GitHub (pinned to 61d3082821)
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
Example fix
// before ignored_content = ["**["] // after ignored_content = ["**/drafts/**"]
Defensive patterns
Strategy: validation
Validate before calling
fn globs_valid(pats: &[String]) -> bool {
pats.iter().all(|p| globset::Glob::new(p).is_ok())
} Try / catch
match build_ignore_glob_set(&pats, "ignored_content") {
Ok(gs) => use(gs),
Err(e) if e.to_string().contains("Invalid") && e.to_string().contains("glob pattern") => {
eprintln!("check the pattern named in: {e}");
}
Err(e) => return Err(e),
} Prevention
- 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)
When it happens
Trigger: 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`.
Common situations: Typos in config.toml glob patterns; copying shell-style globs unsupported by the globset syntax; quotes/escaping issues in TOML.
Related errors
- Invalid glob for sass
- Theme `{}` is missing a templates folder
- Either a `templates/` folder or a theme is required
- could not parse domain `{}` from link
- could not parse domain `{}` from link: `{}`
AI-assisted analysis of getzola/zola@61d3082821 (2026-09-03).
Data as JSON: /api/errors/03b7ce1a2a5a8bfd.
Report an issue: GitHub.