{"record":{"id":"a6cf3e621fdde87b","repo":"angular/angular-cli","slug":"dependency-not-found","errorCode":null,"errorMessage":"Dependency not found.","messagePattern":"Dependency not found\\.","errorType":"exception","errorClass":"DependencyNotFoundException","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/core/src/utils/partially-ordered-set.ts","lineNumber":113,"sourceCode":"        for (const dep of itemDeps) {\n          if (!deps.has(dep)) {\n            equal = false;\n            break;\n          }\n        }\n      }\n\n      if (equal) {\n        return this;\n      } else {\n        this._items.delete(item);\n      }\n    }\n\n    // Verify all dependencies are part of the Set.\n    for (const dep of deps) {\n      if (!this._items.has(dep)) {\n        throw new DependencyNotFoundException();\n      }\n    }\n\n    // Verify there's no dependency cycle.\n    this._checkCircularDependencies(item, deps);\n\n    this._items.set(item, new Set(deps));\n\n    return this;\n  }\n\n  delete(item: T): boolean {\n    if (!this._items.has(item)) {\n      return false;\n    }\n\n    // Remove it from all dependencies if force == true.\n    this._items.forEach((value) => value.delete(item));","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/core/src/utils/partially-ordered-set.ts#L95-L131","documentation":"PartiallyOrderedSet.add verifies that every declared dependency is already a member of the set; if any dependency was never added, it throws DependencyNotFoundException ('Dependency not found.'). The set requires all dependencies to be registered as items, even if added without ordering guarantees. This check runs before the circular-dependency check in add().","triggerScenarios":"add('a', ['b']) where 'b' was never added via this.add('b', ...), dependency names misspelled or differing in case, an earlier add of the dependency failed/short-circuited, items removed via delete/clear while others still reference them.","commonSituations":"Plugin/registry setups where the dependency plugin isn't loaded yet, renaming an item but not updating dependents, typos in dependency strings, loading order where dependents register before their dependencies in a lazy-initialized registry.","solutions":["Add the missing dependency first: set.add('b', []) before set.add('a', ['b'])","Fix the dependency name to exactly match the registered item identifier","Check registration order/conditional logic that skipped adding the dependency; ensure remove/delete doesn't leave dangling dependents"],"exampleFix":"// before\npos.add('build', ['compile-missing'])\n// after\npos.add('compile', []);\npos.add('build', ['compile']);","handlingStrategy":"validation","validationCode":"function assertDependenciesRegistered(pos: { has(item: unknown): boolean }, item: string, deps: Iterable<string>): void {\n  const missing = [...deps].filter((d) => !pos.has(d));\n  if (missing.length) {\n    throw new Error(`Cannot add '${item}': dependencies not found: ${missing.join(', ')}`);\n  }\n}\n// call before pos.add(item, deps)","typeGuard":"null","tryCatchPattern":"try {\n  pos.add(item, deps);\n} catch (e) {\n  if ((e as Error).message === 'Dependency not found.') {\n    // ensure the dependency is added first or fix the identifier spelling\n  }\n  throw e;\n}","preventionTips":["Register dependencies before dependents; document the required order","Use a single constants module for item identifiers to avoid typos","On registry teardown, remove dependents before their dependencies","Add a test asserting every declared dependency exists after full registration"],"tags":["dependency-not-found","topological-sort","registration-order"],"backgroundTag":"missing-dependency","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}