{"record":{"id":"1887590772272819","repo":"nodejs/node","slug":"dependency-s-not-found-while-trying-to-load-tar","errorCode":null,"errorMessage":"Dependency '%s' not found while trying to load target %s","messagePattern":"Dependency '(.+?)' not found while trying to load target (.+?)","errorType":"exception","errorClass":"GypError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/input.py","lineNumber":1950,"sourceCode":"    dependency_nodes = {}\n    for target, spec in targets.items():\n        if target not in dependency_nodes:\n            dependency_nodes[target] = DependencyGraphNode(target)\n\n    # Set up the dependency links.  Targets that have no dependencies are treated\n    # as dependent on root_node.\n    root_node = DependencyGraphNode(None)\n    for target, spec in targets.items():\n        target_node = dependency_nodes[target]\n        dependencies = spec.get(\"dependencies\")\n        if not dependencies:\n            target_node.dependencies = [root_node]\n            root_node.dependents.append(target_node)\n        else:\n            for dependency in dependencies:\n                dependency_node = dependency_nodes.get(dependency)\n                if not dependency_node:\n                    raise GypError(\n                        \"Dependency '%s' not found while \"\n                        \"trying to load target %s\" % (dependency, target)\n                    )\n                target_node.dependencies.append(dependency_node)\n                dependency_node.dependents.append(target_node)\n\n    flat_list = root_node.FlattenToList()\n\n    # If there's anything left unvisited, there must be a circular dependency\n    # (cycle).\n    if len(flat_list) != len(targets):\n        if not root_node.dependents:\n            # If all targets have dependencies, add the first target as a dependent\n            # of root_node so that the cycle can be discovered from root_node.\n            target = next(iter(targets))\n            target_node = dependency_nodes[target]\n            target_node.dependencies.append(root_node)\n            root_node.dependents.append(target_node)","sourceCodeStart":1932,"sourceCodeEnd":1968,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/input.py#L1932-L1968","documentation":"When constructing the target-level dependency graph (input.py ~1950), each entry in a target's 'dependencies' list must resolve to an already-built DependencyGraphNode. If dependency_nodes.get(dependency) is None, the referenced qualified target was never registered, so gyp cannot wire the edge and raises GypError naming both the missing dependency and the target that referenced it.","triggerScenarios":"For target T with spec['dependencies'] containing D, dependency_nodes has no key D after all targets were loaded. Occurs right before FlattenToList, so it is a hard load-time failure.","commonSituations":"Typo in a dependency qualified target name; referring to path/to.gyp:target where target does not exist in that file; wrong build-file path component (relative path mismatch); dependency on a target guarded by a conditional that evaluated false; .gyp file not actually included into the build.","solutions":["Verify the dependency string exactly matches 'path/to.gyp:target_name' (correct relative path, correct target_name).","Confirm the referenced target actually exists and is not inside a false conditional.","Ensure the .gyp file declaring the target is included (directly or transitively) by the build.","Check for toolset mismatches if using multi-toolset builds."],"exampleFix":"// before\n'dependencies': ['../util/util.gyp:utillib']  // target is actually 'util_lib'\n\n// after\n'dependencies': ['../util/util.gyp:util_lib']","handlingStrategy":"validation","validationCode":"known = set(targets)\nfor t, spec in targets.items():\n    for d in spec.get('dependencies', []):\n        assert d in known, 'unresolvable dependency %r in %r' % (d, t)\n","typeGuard":"def deps_resolve(deps, known): return all(d in known for d in deps)","tryCatchPattern":"try:\n    gyp.main(args)\nexcept gyp.input.GypError as e:\n    if 'not found while trying to load target' in str(e): print('Check dependency spelling/path'); raise","preventionTips":["Use consistent qualified target naming (path.gyp:name).","Run gyp --check after editing dependencies.","Verify included .gyp files expose the referenced targets."],"tags":["gyp","dependency-graph","validation","build-config"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}