Score:2

"RuntimeException: You have requested a non-existent parameter 'app.root'"

cn flag

After I clear the cache, I get this message.

Symfony\Component\DependencyInjection\Exception\RuntimeException: You have requested a non-existent parameter "app.root". in Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue() (line 37 of /var/www/call/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php). Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue() (Line: 60) Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue() (Line: 30) Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue() (Line: 39) Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process() (Line: 140) Symfony\Component\DependencyInjection\Compiler\Compiler->compile() (Line: 789) Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1335) Drupal\Core\DrupalKernel->compileContainer() (Line: 916) Drupal\Core\DrupalKernel->initializeContainer() (Line: 477) Drupal\Core\DrupalKernel->boot() (Line: 707) Drupal\Core\DrupalKernel->handle() (Line: 19)

Do you have any idea on how to solve this problem?

cn flag
The second line says `You have requested a non-existent parameter "app.root".` Try searching your code base for `app.root` and see where you are requiring it.
Dragan Petrovic FSD avatar
cn flag
All are related to drupal console
cn flag
What version of Drupal console? Are you sure the version is compatible with 8.9.20?
Dragan Petrovic FSD avatar
cn flag
"drupal/console": "^1.9",
leymannx avatar
ne flag
Remove Drupal Console and retry.
Dragan Petrovic FSD avatar
cn flag
same problem, same error
Score:3
cn flag

This error is caused by code using %app.root% as parameter in Drupal 8.

For example:

   cache.backend.apcu:
     class: Drupal\Core\Cache\ApcuBackendFactory
     arguments: ['%app.root%', '%site.path%', '@cache_tags.invalidator.checksum']

This is Drupal 9 code not working in Drupal 8.

The service argument @app.root on the other hand is not causing this error. You find it in Drupal Console or other Drupal 8 code. It was deprecated in Drupal 9, but is still working until you update to Drupal 10. Then it will be this error "Non-existent service" errors after clearing the cache

See the change record https://www.drupal.org/node/3080612.

Score:2
us flag

The app.root parameter has been added in Drupal 9 to replace the app.root service. If you are using Drupal 8, that error could possibly be causes by:

  • A module that says to be compatible with Drupal 8 and Drupal 9, whose code accesses the app.root container parameter when it runs on Drupal 8
  • Other code that tries to access the app.root container parameter when it runs on Drupal 8

This could happen because:

  • One of the arguments for a service is '%app.root%' (which requires the container parameter) instead of '@app.root' (which requires the service that exists in Drupal 8.x)
  • There is code that uses $container->getParameter('app.root') instead of $container->get('app.root')
  • There is code that checks whether to use the app.root container parameter or the app.root service, but it fails to use the available one

To understand which code causes the error, it should be sufficient to search for %app.root% or ->getParameter('app.root'). Searching for app.root isn't sufficient, as it would return any line that correctly uses the app.root service.

[Symfony 5] Replace app.root and site.path string services with container parameters has been created has been created on August 13, 2019 and marked as fixed on December 23, 2020. (The patch was committed on Drupal 9.x on March 5, 2020.)
Drupal Console 1.9.4 (released on November 11, 2019) should not contain code that accesses the app.root container parameter, as Drupal core didn't even have that container parameter when Drupal Console 1.9.4 was released.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.