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:
@Service() or the @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 @Service() and has its own constructor dependencies, the error can still occur.
@Service() decoratorWhen a class has constructor dependencies but lacks the @Service() decorator, Angular cannot resolve its parameters:
export class UserClient {
constructor(private http: HttpClient) {} // Angular can't resolve this
}
Add the @Service() decorator to fix this:
@Service()
export class UserClient {
constructor(private http: HttpClient) {}
}
This error also appears when Angular cannot determine the type of a constructor parameter:
@Service()
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 @Service or @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:
@Service or @Injectable() decoratorInjectionToken has a configured provider or default value