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.
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.
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.
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.