{"record":{"id":"271beedc69d59d6a","repo":"getzola/zola","slug":"propagated-sass-compilation-error","errorCode":null,"errorMessage":"(propagated SASS compilation error)","messagePattern":"\\(propagated SASS compilation error\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"components/site/src/sass.rs","lineNumber":26,"sourceCode":"use crate::anyhow;\nuse errors::{Result, bail};\nuse utils::fs::{create_directory, create_file};\n\npub fn compile_sass(base_path: &Path, output_path: &Path) -> Result<()> {\n    create_directory(output_path)?;\n\n    let sass_path = {\n        let mut sass_path = PathBuf::from(base_path);\n        sass_path.push(\"sass\");\n        sass_path\n    };\n\n    let options = Options::default().style(OutputStyle::Compressed);\n    let files = get_non_partial_scss(&sass_path);\n    let mut compiled_paths = Vec::new();\n\n    for file in files {\n        let css = compile_file(&file, &options).map_err(|e| anyhow!(e))?;\n\n        let path_inside_sass = file.strip_prefix(&sass_path).unwrap();\n        let parent_inside_sass = path_inside_sass.parent();\n        let css_output_path = output_path.join(path_inside_sass).with_extension(\"css\");\n\n        if parent_inside_sass.is_some() {\n            fs::create_dir_all(css_output_path.parent().unwrap())?;\n        }\n\n        create_file(&css_output_path, &css)?;\n        compiled_paths.push((path_inside_sass.to_owned(), css_output_path));\n    }\n\n    compiled_paths.sort();\n    for window in compiled_paths.windows(2) {\n        if window[0].1 == window[1].1 {\n            bail!(\n                \"SASS path conflict: \\\"{}\\\" and \\\"{}\\\" both compile to \\\"{}\\\"\",","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/getzola/zola/blob/61d30828217957120309db657950224edf9707e2/components/site/src/sass.rs#L8-L44","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the wrapped compiler error for the exact file/line and fix the SCSS syntax","Check every @import/@use path resolves to an existing (partial) file; partials must start with underscore","Split large recent changes — bisect by temporarily removing files from sass/ to find the offender","If a non-stylesheet file lives in sass/, move it out or prefix it with _ to make it a partial"],"exampleFix":"// before (sass/site.scss)\n.body { color: $primary }\n// after (missing $primary definition fixed)\n@import 'variables';\n.body { color: $primary; }","handlingStrategy":"validation","validationCode":"// Lint SCSS before building:\n// npx sass --no-source-map sass/:/tmp/out && rm -rf /tmp/out","typeGuard":null,"tryCatchPattern":"// Rust\nmatch site.load() {\n    Err(e) => {\n        eprintln!(\"SASS/compile failed, underlying cause:\\n{e:#}\");\n        std::process::exit(1);\n    }\n    Ok(_) => {}\n}\n// Use {:#} (alternate) on anyhow errors to see the full cause chain","preventionTips":["Prefix all partials with _ so they are not compiled standalone","Keep @import/@use targets consistent when renaming partials","Test stylesheet changes with a fast standalone sass compile before a full build"],"tags":["rust","sass","scss","compilation"],"backgroundTag":"sass-compilation-error","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"}