getzola/zola · error

Invalid glob for sass

Error message

Invalid glob for sass

What it means

get_non_partial_scss compiles the hardcoded glob pattern "*.{sass,scss}" via the globset crate to find non-partial Sass files. The pattern is fixed in source, so this expect can only fire if the globset version in use cannot parse brace-alternation syntax — i.e. a build with an incompatible/broken globset.

Source

Thrown at components/site/src/sass.rs:60

        if window[0].1 == window[1].1 {
            bail!(
                "SASS path conflict: \"{}\" and \"{}\" both compile to \"{}\"",
                window[0].0.display(),
                window[1].0.display(),
                window[0].1.display(),
            );
        }
    }

    Ok(())
}

fn is_partial_scss(entry: &DirEntry) -> bool {
    entry.file_name().to_str().map(|s| s.starts_with('_')).unwrap_or(false)
}

fn get_non_partial_scss(sass_path: &Path) -> Vec<PathBuf> {
    let glob = Glob::new("*.{sass,scss}").expect("Invalid glob for sass").compile_matcher();

    WalkDir::new(sass_path)
        .into_iter()
        .filter_entry(|e| !is_partial_scss(e))
        .filter_map(|e| e.ok())
        .map(|e| e.into_path())
        .filter(|e| glob.is_match(e))
        .collect::<Vec<_>>()
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_get_non_partial_scss() {
        use std::env;

View on GitHub (pinned to 61d3082821)

Solutions

  1. Pin/restore a known-good globset version in Cargo.lock (cargo update -p globset --precise <good-version>).
  2. Verify the error isn't a stale/incomplete build; run cargo clean and rebuild.
  3. If editing the pattern, validate it with Glob::new in a test before shipping.
  4. Replace the hardcoded pattern with a simpler one (e.g. two globs: *.sass, *.scss) if brace syntax is the problem.

Example fix

// before
let glob = Glob::new("*.{sass,scss}").expect("Invalid glob for sass").compile_matcher();
// after
let glob = Glob::new("*.sass").expect("Invalid glob").compile_matcher();
let glob2 = Glob::new("*.scss").expect("Invalid glob").compile_matcher();
Defensive patterns

Strategy: validation

Validate before calling

// Validate the glob compiles before relying on it
if globset::Glob::new("*.{sass,scss}").is_err() {
    eprintln!("globset cannot parse sass glob; check globset version");
}

Try / catch

match Glob::new("*.{sass,scss}") {
    Ok(g) => g.compile_matcher(),
    Err(e) => { log::error!("bad sass glob: {}", e); Glob::new("*.scss").unwrap().compile_matcher() }
}

Prevention

When it happens

Trigger: Calling compile_sass (which invokes get_non_partial_scss) when the globset dependency fails to parse the hardcoded pattern — practically only with an unusual globset version/feature regression, since the pattern itself is static.

Common situations: A dependency update (globset regression) or a vendored/patched build missing brace expansion support; fork builds with altered globset features.

Related errors


AI-assisted analysis of getzola/zola@61d3082821 (2026-09-03). Data as JSON: /api/errors/399e83faaaca6658. Report an issue: GitHub.