elkowar/eww · error

scope inherited variable that parent scope doesn't have…

Error message

scope inherited variable that parent scope doesn't have access to

What it means

ScopeGraph::validate checks that every variable a scope inherits through an inheritance relation is actually accessible from the parent scope. If the parent scope has no access to the inherited variable, the graph is invalid and this error is raised.

Solutions

  1. Make sure the variable is defined/accessible in the parent scope (or its ancestors) before inheriting it
  2. Fix typos in the variable name inside the scope's include/inherit list
  3. Remove the stale inherited variable from the child scope definition
  4. Run `eww reload` after edits and check `eww state` to see which variables exist

Example fix

;; before
(defwidget child [inherited-var] ...)
(defscope child :inherits "parent") ; parent has no access to inherited-var
;; after
(defwidget parent [inherited-var] ...)
(defscope child :inherits "parent")
Defensive patterns

Strategy: validation

Validate before calling

// Before reload, check every inherited var is referenced by the parent scope:
const missing = inheritedVars.filter(v => !parentScopeVars.includes(v));
if (missing.length) throw new Error(`parent lacks: ${missing.join(', ')}`);

Try / catch

try { eww.reload(); } catch (e) { if (String(e).includes("scope inherited variable")) { console.error('Fix inheritance: parent scope lacks an inherited var'); } else { throw e; } }

Prevention

When it happens

Trigger: Defining yuck scopes with (include) / inheritance where a child scope inherits variables the parent scope cannot see — e.g. inheriting a var that isn't referenced by the parent scope or its own ancestors.

Common situations: Copy-pasted scope definitions where an (include) lists a variable unavailable in the parent; renamed variables in the parent without updating children; typos in variable names inside inheritance relations.

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/9036d449954be225. Report an issue: GitHub.

Appendix: source

Thrown at crates/eww/src/state/scope_graph.rs:535

                }
            }
            for (child_scope, (parent_scope_idx, edge)) in &self.inheritance_relations.child_to_parent {
                if !self.scopes.contains_key(child_scope) {
                    bail!("inheritance_relations lists key that is not in graph");
                }
                if let Some(parent_scope) = self.scopes.get(parent_scope_idx) {
                    // check that everything the scope references from it's parent is actually
                    // accessible by the parent, meaning it either stores it directly or
                    // inherits it itself
                    for var in &edge.references {
                        let parent_has_access_to_var = parent_scope.data.contains_key(var)
                            || self
                                .inheritance_relations
                                .child_to_parent
                                .get(parent_scope_idx)
                                .map_or(false, |(_, e)| e.references.contains(var));
                        if !parent_has_access_to_var {
                            bail!("scope inherited variable that parent scope doesn't have access to");
                        }
                    }
                } else {
                    bail!("inheritance_relations values lists scope that is not in graph");
                }
            }

            self.hierarchy_relations.validate()?;
            self.inheritance_relations.validate()?;

            Ok(())
        }

        pub fn visualize(&self) -> String {
            let mut output = String::new();
            output.push_str("digraph {\n");

            for (scope_index, scope) in &self.scopes {

View on GitHub (pinned to 48f5aa8b37)