Symfony "lint:container" service wiring check failed in CI
lint:container compiles the container and validates that every argument can be resolved. A failure means at least one service references a type, id, or argument the container cannot satisfy, which would also crash the app at boot.
What this error means
A CI step running bin/console lint:container exits non-zero and prints the offending service and argument, for example an unresolvable typed argument or a missing referenced id.
In CheckTypeDeclarationsPass.php line 175:
Invalid definition for service "App\Service\Invoicer": argument 1 of
"App\Service\Invoicer::__construct()" accepts "App\Client\PaymentClientInterface",
"string" passed.Common causes
An argument type does not match the definition
A bound value or referenced service does not satisfy the constructor type hint, so the container definition is invalid.
A referenced service or interface is unresolvable
The definition points at an id or interface with no matching service, the same class of problem that autowiring reports at boot.
How to fix it
Read the failing definition and correct the argument
- Run
lint:containerwith the CI environment to see the exact service and argument. - Fix the binding so the value or referenced service matches the type hint.
- Re-run until the linter reports the container is valid.
APP_ENV=test php bin/console lint:containerAlias interfaces the linter cannot resolve
Provide an alias from the interface to a concrete service so typed arguments resolve during compilation.
# config/services.yaml
services:
App\Client\PaymentClientInterface: '@App\Client\StripePaymentClient'How to prevent it
- Run
lint:containerin CI so wiring problems fail before deploy. - Keep argument bindings and type hints consistent.
- Alias every injectable interface to a concrete implementation.