Skip to content
Latchkey

Bazel "Skipping ... no such target" in CI

Bazel found the package but no target with the requested name. The rule was renamed, never declared, or the label has a typo.

What this error means

A build reports "ERROR: Skipping //pkg:name: no such target //pkg:name: target name not declared in package". Bazel often lists the valid target names it did find.

bazel
ERROR: Skipping '//libs/auth:server': no such target '//libs/auth:server':
target 'server' not declared in package 'libs/auth' defined by
/workspace/libs/auth/BUILD.bazel (did you mean 'auth_server'?)

Common causes

Target name does not exist

The label names a rule that is not declared in that package BUILD file. Bazel suggests near matches when it can.

Rule renamed without updating callers

A target was renamed in the BUILD file but scripts, CI commands, or deps still reference the old name.

Typo in the label

Bazel target names are exact and case-sensitive; auth_server and authServer are different targets.

How to fix it

List the real targets in the package

  1. Query the package to see what targets actually exist.
  2. Match the label to one of them exactly.
Terminal
bazel query '//libs/auth:*'

Fix the label or declare the target

  1. Correct the name in the failing command or dependency.
  2. Or add the missing rule to the package BUILD file.

How to prevent it

  • Use bazel query in code review to verify target names, and grep for old names after any rename.

Frequently asked questions

What causes ""no such target""?
The label names a rule that is not declared in that package BUILD file. Bazel suggests near matches when it can.
How do I fix "no such target"?
List the real targets in the package

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card