CircleCI "Cannot find a definition for command" Error
A job step that calls a reusable command must reference a command defined under the top-level commands: key or provided by an imported orb. A typo or missing definition fails config validation.
What this error means
Config processing fails stating it cannot find a definition for a command name used in a job step.
circleci
Cannot find a definition for command named install-deps
in job build. Commands must be declared under the top-level commands key.Common causes
Command not declared
The command name is used in steps but never defined under commands:.
Typo or wrong namespace
The step references a slightly different name, or an orb command without the orb/ prefix.
Orb not imported
A command from an orb requires the orb to be listed under orbs:.
How to fix it
Declare the command
Define the reusable command under the top-level commands key and call it exactly.
.circleci/config.yml
commands:
install-deps:
steps:
- run: npm ci
jobs:
build:
steps:
- install-depsHow to prevent it
- Declare every reusable command under commands:.
- Match command names exactly, including orb prefixes.
- Validate config locally with the CircleCI CLI before pushing.
Related guides
CircleCI "Cannot find a definition for executor" ErrorFix CircleCI cannot find a definition for executor X - the job references an executor that is undefined, miss…
CircleCI "parameter X is not declared" ErrorFix CircleCI parameter X is not declared - a job, command, or executor uses a parameter that was never declar…
CircleCI Reusable Config "maximum recursion depth exceeded"Fix CircleCI reusable config recursion errors - a command, executor, or orb that references itself directly o…