Skip to content

cache:pool:clear --all command fails in a prod environment #53551

@LiquidPL

Description

@LiquidPL

Symfony version(s) affected

7.0.2, 6.4.2

Description

When trying to clear cache pools using the cache:pool:clear --all command while in a production environment (i.e. APP_ENV=prod), the command fails with the following error on Symfony 6.4:

In Container.php line 249:
                                                                                                                                                                                                              
  The "cache.annotations" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection   
  instead.                                                                                                                                                                                                    
                                                                                                                                                                                                              

cache:pool:clear [--all] [--exclude EXCLUDE] [--] [<pools>...]

Failed to execute command bin/console cache:pool:clear --all: exit status 1

And on Symfony 7.0:

In Container.php line 240:
                                                                                                                                                                                                               
  The "cache.asset_mapper" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection   
  instead.                                                                                                                                                                                                     
                                                                                                                                                                                                               

cache:pool:clear [--all] [--exclude EXCLUDE] [--] [<pools>...]

Failed to execute command bin/console cache:pool:clear --all: exit status 1

Both of these happen only in the prod env, the dev env works perfectly fine.

How to reproduce

  1. Create a new webapp installation of the app from symfony/skeleton.
  2. Change APP_ENV to prod.
  3. Attempt to run the cache:pool:clear --all command.

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions