elkowar/eww · error
inheritance_relations values lists scope that is not in…
Error message
inheritance_relations values lists scope that is not in graph
What it means
ScopeGraph::validate also verifies referential integrity: every scope index listed in inheritance_relations must exist in the graph. If an inheritance relation references a scope that was never added, validation bails with this error.
Solutions
- Fix the :inherits target so it names an existing (defscope ...) / defined scope
- Remove stale inheritance references to deleted scopes
- Order graph construction so scopes are inserted before relations referencing them
- Run a lint/search over the config for the referenced scope name
Example fix
;; before (defscope my-widget :inherits "nonexistent-scope") ;; after (defscope base-scope ...) (defscope my-widget :inherits "base-scope")
Defensive patterns
Strategy: validation
Validate before calling
const scopes = parseDefscopes(yuckSource);
for (const s of scopes) {
if (s.inherits && !scopes.some(x => x.name === s.inherits)) throw new Error(`unknown scope: ${s.inherits}`);
} Type guard
function scopeExists(name, graph) { return graph.scopes.has(name); } Try / catch
try { eww.reload(); } catch (e) { if (String(e).includes('not in graph')) { console.error('An :inherits target references an undefined scope'); } else { throw e; } } Prevention
- Define all (defscope) targets before referencing them in :inherits
- Grep the config for scope names after renames/deletions
- Insert scopes before relations when building graphs programmatically
- Keep one canonical place for scope definitions
When it happens
Trigger: A scope declares inheritance from a scope name/index that does not exist in the graph — typically referencing an undefined or removed scope in yuck, or an index mismatch when building the graph programmatically.
Common situations: Typos in :inherits scope names in yuck configs; deleting/renaming a scope but leaving stale references; programmatic graph construction inserting relations before adding the referenced scope.
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
- scope inherited variable that parent scope doesn't have…
- Error, missing argument
- variables unexpectedly defined when creating window with id
- This widget can only be used as a child of some container…
AI-assisted analysis of elkowar/eww@48f5aa8b37 (2026-09-08).
Data as JSON: /api/errors/e3c7f636f620f53c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/eww/src/state/scope_graph.rs:539
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 {
output.push_str(&format!(
" \"{:?}\"[label=\"{}\\n{}\"]\n",
scope_index,
scope.name,View on GitHub (pinned to 48f5aa8b37)