elkowar/eww · error

SCSS parsing error

Error message

SCSS parsing error: {}

What it means

When the config uses eww.scss, parse_scss_from_config feeds the file through the grass SCSS compiler. Any compile error (syntax, unknown mixin, bad interpolation) is wrapped as 'SCSS parsing error: {}'.

Solutions

  1. Read the grass error message (it includes line/column) and fix the SCSS at that spot
  2. Try compiling the file with `grass` or check grass's supported SCSS feature set
  3. Simplify or replace unsupported SCSS constructs with plain CSS

Example fix

// before: unbalanced interpolation
.foo { color: #{lighten($accent, 10%; }

// after
.foo { color: #{lighten($accent, 10%)}; }
Defensive patterns

Strategy: validation

Validate before calling

# compile-check SCSS before loading
grass ~/.config/eww/eww.scss > /dev/null && echo OK

Try / catch

match config::scss::parse_scss_from_config(&dir) {
    Ok((id, css)) => /* proceed */,
    Err(e) => eprintln!("stylesheet error: {e:#}"),
}

Prevention

When it happens

Trigger: grass::from_string fails while compiling the contents of eww.scss during config load or reload — invalid SCSS syntax, unbalanced braces/parens, unknown functions or mixin misuse.

Common situations: SCSS copied from a project using dart-sass features grass doesn't implement; typo in a variable or mixin; unbalanced parentheses in an interpolation; stale cached config reloaded after a bad edit.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of elkowar/eww@48f5aa8b37 (2026-09-08). Data as JSON: /api/errors/e6ce9a0f1c021830. Report an issue: GitHub.

Appendix: source

Thrown at crates/eww/src/config/scss.rs:27

/// Also adds the CSS to the [`crate::file_database::FileDatabase`]
pub fn parse_scss_from_config(path: &Path) -> anyhow::Result<(usize, String)> {
    let css_file = path.join("eww.css");
    let scss_file = path.join("eww.scss");
    if css_file.exists() && scss_file.exists() {
        return Err(anyhow!("Encountered both an SCSS and CSS file. Only one of these may exist at a time"));
    }

    let (s_css_path, css) = if css_file.exists() {
        let css_file_content = std::fs::read_to_string(&css_file)
            .with_context(|| format!("Given CSS file doesn't exist: {}", css_file.display()))?;
        let css = replace_env_var_references(css_file_content);
        (css_file, css)
    } else {
        let scss_file_content =
            std::fs::read_to_string(&scss_file).with_context(|| format!("Given SCSS file doesn't exist! {}", path.display()))?;
        let file_content = replace_env_var_references(scss_file_content);
        let grass_config = grass::Options::default().load_path(path);
        let css = grass::from_string(file_content, &grass_config).map_err(|err| anyhow!("SCSS parsing error: {}", err))?;
        (scss_file, css)
    };

    let mut file_db = error_handling_ctx::FILE_DATABASE.write().unwrap();
    let file_id = file_db.insert_string(s_css_path.display().to_string(), css.clone())?;
    Ok((file_id, css))
}

View on GitHub (pinned to 48f5aa8b37)