{"record":{"id":"9036d449954be225","repo":"elkowar/eww","slug":"scope-inherited-variable-that-parent-scope-doesn-t","errorCode":null,"errorMessage":"scope inherited variable that parent scope doesn't have access to","messagePattern":"scope inherited variable that parent scope doesn't have access to","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/eww/src/state/scope_graph.rs","lineNumber":535,"sourceCode":"                }\n            }\n            for (child_scope, (parent_scope_idx, edge)) in &self.inheritance_relations.child_to_parent {\n                if !self.scopes.contains_key(child_scope) {\n                    bail!(\"inheritance_relations lists key that is not in graph\");\n                }\n                if let Some(parent_scope) = self.scopes.get(parent_scope_idx) {\n                    // check that everything the scope references from it's parent is actually\n                    // accessible by the parent, meaning it either stores it directly or\n                    // inherits it itself\n                    for var in &edge.references {\n                        let parent_has_access_to_var = parent_scope.data.contains_key(var)\n                            || self\n                                .inheritance_relations\n                                .child_to_parent\n                                .get(parent_scope_idx)\n                                .map_or(false, |(_, e)| e.references.contains(var));\n                        if !parent_has_access_to_var {\n                            bail!(\"scope inherited variable that parent scope doesn't have access to\");\n                        }\n                    }\n                } else {\n                    bail!(\"inheritance_relations values lists scope that is not in graph\");\n                }\n            }\n\n            self.hierarchy_relations.validate()?;\n            self.inheritance_relations.validate()?;\n\n            Ok(())\n        }\n\n        pub fn visualize(&self) -> String {\n            let mut output = String::new();\n            output.push_str(\"digraph {\\n\");\n\n            for (scope_index, scope) in &self.scopes {","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/elkowar/eww/blob/48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa/crates/eww/src/state/scope_graph.rs#L517-L553","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Make sure the variable is defined/accessible in the parent scope (or its ancestors) before inheriting it","Fix typos in the variable name inside the scope's include/inherit list","Remove the stale inherited variable from the child scope definition","Run `eww reload` after edits and check `eww state` to see which variables exist"],"exampleFix":";; before\n(defwidget child [inherited-var] ...)\n(defscope child :inherits \"parent\") ; parent has no access to inherited-var\n;; after\n(defwidget parent [inherited-var] ...)\n(defscope child :inherits \"parent\")","handlingStrategy":"validation","validationCode":"// Before reload, check every inherited var is referenced by the parent scope:\nconst missing = inheritedVars.filter(v => !parentScopeVars.includes(v));\nif (missing.length) throw new Error(`parent lacks: ${missing.join(', ')}`);","typeGuard":null,"tryCatchPattern":"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; } }","preventionTips":["Keep inherited variables defined in the parent scope chain","Avoid copy-pasting includes between scopes without checking availability","Rename variables consistently across parent and child scopes","Validate the config after every edit with `eww reload`"],"tags":["yuck","config-validation","scope","inheritance"],"backgroundTag":"schema-validation-failed","analyzedSha":"48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa","analyzedAt":"2026-09-08T03:13:26.897Z","contentChangedAt":"2026-09-08T03:13:26.897Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}