Learn how to solve the non-existent parameter "kernel.secret" error in your symfony project.

If you're stuck with the following exception in your Symfony project:

Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException' with message 'The service "uri_signer" has a dependency on a non-existent parameter "kernel.secret". Did you mean this: "kernel.charset"?'

In this article you will learn how to solve it in this article easily.


The error simply warns of the absence of the secret parameter in some used configuration YAML file. The problem is caused, basically, when you work in some way that you need to: either modify, work with multiple index app files in your project or to modify your configuration YAML files. This error occurs often with the implementation of bundles that require you to modify those files like the MobileDetectBundle.

To solve it, the first thing you need to do, is to check on your config.yml or your custom YAML config file and import the parameters.yml file:

    - { resource: parameters.yml }

Inside the parameters.yml (you will forgive the repetition) a parameter identified with secret. As you may know (or maybe not) the secret is a string that should be unique to your application and it's commonly used to add more entropy to security related operations. Its value should be a series of characters, numbers and symbols chosen randomly and the recommended length is around 32 characters. Remember that this value can't be null or empty.

Then once the file is imported in your config.yml (or custom config file), proceed to add the secret property in the framework area like this:

    secret: "%secret%"

Finally, don't forget to clear the cache of your project by deleting the cache folder manually or by running the symfony command php bin/console cache:clear --env=prod.

Happy coding !

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.