CircleCI Reusable Command "required parameter" - Fix Params
A reusable command or executor was invoked without a required parameter, or its steps reference a parameter that was never declared. Parameterized commands only resolve when every << parameters.* >> is declared and every required value is supplied.
What this error means
Validation fails naming a missing required parameter or an undeclared one. The command cannot be expanded into steps because a parameter reference has no value or no declaration.
Config is invalid:
- command 'deploy': required parameter 'environment' not provided
- command 'deploy': parameter 'reigon' is not declaredCommon causes
Required parameter omitted at the call site
A parameter without a default: is required. Invoking the command without it fails validation.
Step references an undeclared parameter
Using << parameters.region >> inside the command’s steps requires a matching parameters: entry. A typo (reigon) has no declaration.
Wrong parameter type
Passing a string where the parameter declares type: integer or type: boolean, or a value outside an enum, is rejected.
How to fix it
Declare parameters and pass required ones
commands:
deploy:
parameters:
environment:
type: enum
enum: [staging, production]
region:
type: string
default: us-east-1
steps:
- run: ./deploy.sh --env << parameters.environment >> --region << parameters.region >>
jobs:
release:
docker: [{ image: cimg/base:current }]
steps:
- checkout
- deploy:
environment: productionGive optional parameters defaults
- Add a
default:to any parameter the caller may omit. - Reference only declared parameters in the command’s steps.
- Match the passed value to the declared
type/enum.
How to prevent it
- Declare every parameter a command/executor references in its steps.
- Give optional parameters defaults so callers can omit them.
- Validate config so missing/mistyped parameters fail on the PR.