getzola/zola · error

SASS path conflict: "{}" and "{}" both compile to "{}"

Error message

SASS path conflict: "{}" and "{}" both compile to "{}"

What it means

`compile_sass` compiles every file under `sass/` and computes each output CSS path. After sorting, it checks adjacent pairs of compiled outputs; if two distinct SASS source paths map to the same CSS output path, it bails because one output file would silently overwrite the other.

Source

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

    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 \"{}\"",
                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();

View on GitHub (pinned to 61d3082821)

Solutions

  1. Find the two conflicting paths from the error message and delete or rename one of them
  2. Rename one file so each compiles to a unique CSS output name
  3. Ensure you don't mix `.scss` and `.sass` extensions for the same logical stylesheet

Example fix

// before
sass/styles.scss
sass/styles.sass
// after
sass/styles.scss
sass/legacy.sass   # renamed so outputs differ
Defensive patterns

Strategy: validation

Validate before calling

fn sass_outputs_unique(files: &[PathBuf]) -> bool {
    let mut outs: Vec<PathBuf> = files.iter().map(|p| css_output_for(p)).collect();
    outs.sort();
    outs.windows(2).all(|w| w[0] != w[1])
}

Try / catch

match compile_sass(&site) {
    Ok(paths) => use(paths),
    Err(e) if e.to_string().contains("SASS path conflict") => {
        let names: Vec<&str> = e.to_string().split('"').collect();
        report_conflict(&names); // surfaces the two colliding files
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Two files in the sass directory tree whose names normalize to the same output path — classically `foo.scss` and `foo.sass` in the same directory, or partial/non-partial naming collisions that compile to identical `foo.css` targets.

Common situations: Having both `styles.scss` and `styles.sass`; case-insensitive filesystems where `Foo.scss` and `foo.scss` collide; copying a theme's sass files over existing ones with a different extension.

Related errors


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