CircleCI "parameter X is not declared" Error
Parameterized jobs, commands, and executors must declare every parameter they use under a parameters: key before referencing it with << parameters.NAME >>. Using an undeclared parameter fails validation.
What this error means
Config processing fails stating a parameter referenced in a job or command is not declared.
In job deploy, parameter env is not declared.
Declare it under the parameters key before using << parameters.env >>.Common causes
Parameter never declared
The reference << parameters.env >> has no matching entry under parameters:.
Declared in the wrong scope
A parameter declared on a command is not visible inside a different job.
Typo between declaration and use
The declared name and the referenced name differ.
How to fix it
Declare the parameter
Add the parameter with a type (and optional default) before referencing it.
jobs:
deploy:
parameters:
env:
type: string
default: staging
steps:
- run: ./deploy.sh << parameters.env >>How to prevent it
- Declare every parameter under the right scope before use.
- Match declared and referenced names exactly.
- Validate parameterized configs with the CircleCI CLI.