adev/src/content/reference/errors/NG0204.md
This error occurs when Angular cannot resolve a dependency for a class during dependency injection. This most commonly affects classes using constructor injection, where Angular relies on TypeScript metadata to determine parameter types.
The most common causes are:
@Injectable() decoratorInjectionToken lacks a proper provider definitionNOTE: The inject() function takes an explicit token, so the "unresolvable parameter" scenario does not apply to it directly. However, if the injected class itself is missing @Injectable() and has its own constructor dependencies, the error can still occur.
@Injectable() decoratorWhen a class has constructor dependencies but lacks the @Injectable() decorator, Angular cannot resolve its parameters:
export class UserClient {
constructor(private http: HttpClient) {} // Angular can't resolve this
}
Add the @Injectable() decorator to fix this:
@Injectable({providedIn: 'root'})
export class UserClient {
constructor(private http: HttpClient) {}
}
This error also appears when Angular cannot determine the type of a constructor parameter:
@Injectable({providedIn: 'root'})
export class DataStore {
// Angular can't resolve 'config' without a provider
constructor(private config: AppConfig) {}
}
Ensure all constructor parameters either have providers configured or use @Optional() for optional dependencies.
The error message includes details about which token could not be resolved:
Can't resolve all parameters for X: (?, ?, ?) — The ? marks indicate unresolvable parameters. Check that the class has @Injectable() and all dependencies have providers.Token X is missing a ɵprov definition — An InjectionToken was used without configuring a provider. Register the token with a value using {provide: TOKEN, useValue: ...} or add a default factory to the token definition.Work backwards from the error's stack trace to identify where the problematic injection occurs, then verify that:
@Injectable() decoratorInjectionToken has a configured provider or default value