AUR0003
Cyclic dependency found: name
Last updated
Was this helpful?
Cyclic dependency found: name
Cyclic dependency found: name
Name of the key being resolved
This error occurs when the DI container detects a cycle in the dependency graph. For example, if class A depends on B, and B depends (directly or indirectly) on A, a cycle is formed: A → B → A or A → B → C → A.
This is most commonly encountered with singletons, since the DI system tries to create only one instance and will detect if it is already in the process of constructing the same dependency.
Two or more classes depend on each other directly or indirectly.
A service or plugin introduces a circular dependency.
Accidental import cycles in your codebase.
Refactor your code to break the cycle. For example, extract the shared logic or dependency into a separate service that both classes can depend on.
Use a getter or static inject to defer the resolution of the dependency, which can sometimes break the cycle:
class Circular {
static get inject() { return [ICircularDep]; }
constructor(dep) { this.dep = dep; }
}Check the stack trace to see the chain of dependencies that led to the cycle.
Search your codebase for all places where the involved classes are injected.
If using plugins, try disabling them one at a time to isolate the source.
Cyclic dependencies are often a sign that your code could be refactored for better separation of concerns.
Please also note that this error could be caused by a plugin and not your application. After ruling out that the error is not being caused by your code, try removing any registered plugins one at a time to see if the error resolves itself.
Last updated
Was this helpful?
Was this helpful?