CircleCI "Cannot find a definition for command named X" error
A step invoked a named command that CircleCI cannot resolve. The command is not defined under the top-level commands key, or it belongs to an orb you did not import.
What this error means
Config processing fails with "Cannot find a definition for command named [X]" at the step that calls it.
CircleCI
Error: config compilation contained errors:
* Cannot find a definition for command named 'install-deps'Common causes
The command is not declared
A step references install-deps but no commands.install-deps exists, or the name is misspelled.
The command is from an unimported orb
You called an orb command without prefixing it with the orb name or without importing the orb.
How to fix it
Define the reusable command
- Add the command under the top-level
commandskey. - Reference it by the exact name in the step.
- For orb commands, use
orb-name/command.
.circleci/config.yml
commands:
install-deps:
steps:
- run: npm ci
jobs:
test:
docker: [{image: cimg/node:20.11}]
steps:
- checkout
- install-depsImport and namespace the orb command
Declare the orb and call its command with the orb prefix.
.circleci/config.yml
orbs:
node: circleci/node@5.2.0
# then call: node/install-packagesHow to prevent it
- Declare every reusable command before referencing it.
- Namespace orb commands with the orb name.
- Validate config so undefined command references fail early.
Related guides
CircleCI "Cannot find a definition for executor named X" errorFix CircleCI "Cannot find a definition for executor named X" - a job references an executor that is not decla…
CircleCI "Cannot find a job named X" workflow errorFix CircleCI "Error calling workflow ... Cannot find a job named X" - a workflow lists a job that is not defi…
CircleCI "Config does not conform to schema" errorFix CircleCI "Config does not conform to schema" - the YAML parses but a key is unknown, mistyped, or has the…