affaan-m/ECC · error · ValueError

Unknown dependency

Error message

Unknown dependency: {dependency}

What it means

validate_graph verifies every node's 'depends' entries: each must be either the literal 'input' or the key of another node in the graph. A dependency naming a node that does not exist raises this ValueError, because the dependency could never be resolved at execution time.

Solutions

  1. Fix the depends entry to match an existing node key or 'input'
  2. Remove the stale dependency if the referenced node was deleted
  3. Add the missing node to contents['nodes'] if it should exist
  4. Diff depends lists against node keys with a lint script before load_graph

Example fix

// before
{"render": {"id": "render", "depends": ["color_grade", "probs"]}}
// after
{"render": {"id": "render", "depends": ["color_grade"]}}
Defensive patterns

Strategy: validation

Validate before calling

def check_dependencies(graph):
    nodes = graph['contents']['nodes']
    for name, node in nodes.items():
        for dep in node.get('depends', []):
            if dep != 'input' and dep not in nodes:
                raise ValueError(f'Unknown dependency: {dep}')

Type guard

def deps_resolvable(graph) -> bool:
    nodes = graph['contents']['nodes']
    return all(d == 'input' or d in nodes
               for node in nodes.values() for d in node.get('depends', []))

Try / catch

try:
    graph = load_graph(path)
except ValueError as e:
    if 'Unknown dependency' in str(e):
        print(f'Dangling depends entry: {e}; fix or remove it')
    else:
        raise

Prevention

When it happens

Trigger: load_graph on a graph JSON where a node's depends list contains a typo, a deleted node's name, or a node added later but never registered in contents['nodes'].

Common situations: Renaming/removing a node without updating dependents' depends lists; hand-editing depends with a typo; merging two graphs where one references the other's nodes.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/29f371b10180b50d. Report an issue: GitHub.

Appendix: source

Thrown at skills/taste-application/scripts/workflow_graphs.py:83

    elif isinstance(value, dict):
        for child in value.values():
            yield from references_in(child)
    elif isinstance(value, list):
        for child in value:
            yield from references_in(child)


def validate_graph(graph):
    """Verify dependencies and every declared input; endpoint schemas need live QA."""
    contents = graph['contents']
    nodes, inputs = contents['nodes'], contents['schema']['input']
    used = set()
    for name, node in nodes.items():
        if node['id'] != name:
            raise ValueError(f'Node id mismatch: {name}')
        for dependency in node.get('depends', []):
            if dependency != 'input' and dependency not in nodes:
                raise ValueError(f'Unknown dependency: {dependency}')
    ancestors = {}

    def visit(name, stack):
        if name == 'input':
            return set()
        if name in stack:
            raise ValueError('Dependency cycle')
        if name not in ancestors:
            deps = nodes[name].get('depends', [])
            ancestors[name] = set(deps).union(*(visit(dep, stack | {name}) for dep in deps))
        return ancestors[name]

    for name, node in nodes.items():
        reachable = visit(name, set())
        for ref in references_in({'input': node.get('input'), 'fields': node.get('fields')}):
            if ref[0] not in reachable:
                raise ValueError(f'{name} references undeclared dependency: {ref[0]}')
            if ref[0] == 'input':

View on GitHub (pinned to 8321021c54)