NG0200 Angular Origin: On your device Last updated 15 Oct 2026

Angular: NG0200: Circular dependency in DI detected for X

Two or more services inject each other (directly or through a chain), so Angular cannot create any of them first.

Exact message you may see NG0200: Circular dependency in DI detected forCircular dependency in DI detectedcyclic dependencyCannot instantiate cyclic dependency
Seen on: Angular TypeScript

Meaning

The injector builds a service by first building its dependencies. If A needs B and B needs A, it loops. Break the cycle by extracting shared logic into a third service, injecting lazily with Injector.get, or using events instead of direct references.

Common causes

  • Service A and service B inject each other
  • A longer cycle through three or more services
  • A token provided in a component that also injects the parent
  • Barrel file import order hiding a cycle
  • An HTTP_INTERCEPTOR injecting a service that uses HttpClient

⚡ Quick fix

  1. Move the shared logic into a third service both depend on
  2. Inject Injector and call injector.get(X) when needed
  3. Break the interceptor cycle by injecting the Injector lazily

Detailed fix by platform

Angular

  1. In an interceptor: const auth = inject(Injector).get(AuthService); inside the function to defer creation
  2. Draw the dependency graph of the services named in the message

Code examples

Lazy injection to break a cycle

typescript
@Injectable({ providedIn: 'root' })
export class AuthInterceptorService {
  private injector = inject(Injector);
  token() { return this.injector.get(AuthService).token; }   // resolved when called, not at construction
}

How to diagnose

  1. Chain — Which services are named in the message?
  2. Cycle — Does A need B and B need A?
  3. Interceptor — Does an interceptor inject something using HttpClient?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

exceeded maximum budget — Angular build: Error: bundle initial exceeded maximum budget. Budget 1.00 MB was not met by 120.00 kB with a total of 1.12 MB (Angular)exceeded maximum budg…NG0201 — Angular: NG0201: No provider for X found in NodeInjector (Angular)NG0201NG0203 — Angular: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer or a function used with runInInjectionContext (Angular)NG0203NullInjectorError — Angular: NullInjectorError: No provider for X! (Angular)NullInjectorErrorNullInjectorError: No provider for ActivatedRoute! — Angular: NullInjectorError: No provider for ActivatedRoute! (also Router) — usually a unit test (Angular)NullInjectorError: No…NullInjectorError: No provider for HttpClient! — Angular: NullInjectorError: No provider for HttpClient! — provideHttpClient() missing (Angular)NullInjectorError: No…Schema validation failed with the following errors — Angular CLI: Schema validation failed with the following errors: Data path "" must NOT have additional properties(xyz) (Angular)Schema validation fai…NG0200

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.