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

  1. Fix the :inherits target so it names an existing (defscope ...) / defined scope
  2. Remove stale inheritance references to deleted scopes
  3. Order graph construction so scopes are inserted before relations referencing them
  4. 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

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


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)