getzola/zola · error

(propagated SASS compilation error)

Error message

(propagated SASS compilation error)

What it means

compile_sass compiles every non-partial .scss/.sass file with grass; if compilation of any file fails (syntax error, bad import, unsupported feature), the error is converted with anyhow! and propagated out of compile_sass. The message shown is the underlying SASS compiler error, wrapped by the caller.

Source

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

use crate::anyhow;
use errors::{Result, bail};
use utils::fs::{create_directory, create_file};

pub fn compile_sass(base_path: &Path, output_path: &Path) -> Result<()> {
    create_directory(output_path)?;

    let sass_path = {
        let mut sass_path = PathBuf::from(base_path);
        sass_path.push("sass");
        sass_path
    };

    let options = Options::default().style(OutputStyle::Compressed);
    let files = get_non_partial_scss(&sass_path);
    let mut compiled_paths = Vec::new();

    for file in files {
        let css = compile_file(&file, &options).map_err(|e| anyhow!(e))?;

        let path_inside_sass = file.strip_prefix(&sass_path).unwrap();
        let parent_inside_sass = path_inside_sass.parent();
        let css_output_path = output_path.join(path_inside_sass).with_extension("css");

        if parent_inside_sass.is_some() {
            fs::create_dir_all(css_output_path.parent().unwrap())?;
        }

        create_file(&css_output_path, &css)?;
        compiled_paths.push((path_inside_sass.to_owned(), css_output_path));
    }

    compiled_paths.sort();
    for window in compiled_paths.windows(2) {
        if window[0].1 == window[1].1 {
            bail!(
                "SASS path conflict: \"{}\" and \"{}\" both compile to \"{}\"",

View on GitHub (pinned to 61d3082821)

Solutions

  1. Read the wrapped compiler error for the exact file/line and fix the SCSS syntax
  2. Check every @import/@use path resolves to an existing (partial) file; partials must start with underscore
  3. Split large recent changes — bisect by temporarily removing files from sass/ to find the offender
  4. If a non-stylesheet file lives in sass/, move it out or prefix it with _ to make it a partial

Example fix

// before (sass/site.scss)
.body { color: $primary }
// after (missing $primary definition fixed)
@import 'variables';
.body { color: $primary; }
Defensive patterns

Strategy: validation

Validate before calling

// Lint SCSS before building:
// npx sass --no-source-map sass/:/tmp/out && rm -rf /tmp/out

Try / catch

// Rust
match site.load() {
    Err(e) => {
        eprintln!("SASS/compile failed, underlying cause:\n{e:#}");
        std::process::exit(1);
    }
    Ok(_) => {}
}
// Use {:#} (alternate) on anyhow errors to see the full cause chain

Prevention

When it happens

Trigger: Calling Site::load / build where a file under sass/ (excluding partials prefixed with _) contains invalid SCSS/SASS syntax, references a missing @import/@use target, or uses syntax grass does not support.

Common situations: Typo or unbalanced brace in a stylesheet; renaming a partial so @import 'variables' no longer resolves; using Ruby/LibSass-only syntax or newer CSS features grass rejects; stray files in sass/ that aren't valid stylesheets.

Related errors


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