Skip to content
Latchkey

Nx "Cannot find configuration for task" - Fix in CI

Nx was asked to run a target on a project, but that project has no such target defined. The task name does not resolve in the project graph - usually a typo, a missing target, or a graph that has not picked up a project.json change.

What this error means

An nx run / nx affected invocation aborts immediately with "Cannot find configuration for task <project>:<target>". Nothing runs because Nx cannot map the task to a target. It is deterministic - the same command fails the same way every time.

Nx output
NX   Cannot find configuration for task api:build

Pass --verbose to see the stacktrace.

Common causes

The target is not defined on the project

The project’s project.json (or inferred plugin config) has no build/test/etc. target with that name. Nx can see the project but not the task.

Typo in the project or target name

A mismatched case or name - api:Build vs api:build, web-app vs webapp - does not resolve. Nx target names are exact.

Stale project graph cache

A project.json or plugin config changed but the cached project graph in .nx/ (or the daemon) still reflects the old shape, so the new target is invisible.

How to fix it

List the project’s real targets

Show what targets actually exist so you can match the name exactly.

Terminal
nx show project api --json | jq '.targets | keys'
# or inspect the graph interactively
nx graph

Define or rename the target

Add the missing target to the project, or correct the name you invoke. Inferred targets come from plugins; explicit ones live in project.json.

project.json
{
  "name": "api",
  "targets": {
    "build": { "executor": "@nx/webpack:webpack", "options": {} }
  }
}

Reset the project graph if it is stale

Clear the cached graph and daemon so a renamed or newly added target is picked up.

Terminal
nx reset
nx run api:build

How to prevent it

  • Reference targets by their exact, lowercase names in scripts and CI.
  • Run nx reset after restructuring projects or editing project.json in bulk.
  • Use nx show project <name> in code review to confirm targets exist.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →