Bazel "Analysis of target failed" in CI
Bazel loaded the packages but analysis failed: a dependency does not provide what a rule expects, an attribute is invalid, or a visibility/constraint rule was violated.
What this error means
The build stops with "ERROR: Analysis of target //pkg:t failed; build aborted" preceded by a more specific message about an attribute, provider, or visibility problem.
bazel
ERROR: /workspace/apps/api/BUILD.bazel:5:10: in deps attribute of go_binary rule
//apps/api:api: '//libs/auth:auth' does not have mandatory provider 'GoLibrary'.
ERROR: Analysis of target '//apps/api:api' failed; build abortedCommon causes
Provider or rule-kind mismatch
A dep is the wrong rule kind for the attribute (for example a cc_library where a go_library is required), so it lacks the mandatory provider.
Invalid attribute value
An attribute is set to a disallowed value or type, which analysis rejects.
Visibility or constraint violation
A target depends on something it is not visible to, or a select() has no matching condition.
How to fix it
Read the specific analysis error above the summary
- The line before "Analysis of target failed" names the real problem.
- Fix the offending attribute, dependency kind, or visibility.
Inspect the dependency edge
- Query why the dependency is included and what it provides.
Terminal
bazel query 'somepath(//apps/api:api, //libs/auth:auth)'How to prevent it
- Match rule kinds across deps and keep visibility explicit so analysis errors surface in review, not CI.
Related guides
Bazel "error loading package" in CIFix Bazel "error loading package" in CI. A BUILD or .bzl file failed to evaluate: a Starlark error, bad load(…
Bazel "Skipping ... no such target" in CIFix Bazel "ERROR: Skipping target: no such target" in CI. The package exists but has no rule with the name in…
Bazel "Build did NOT complete successfully" in CIFix Bazel "ERROR: Build did NOT complete successfully" in CI. This summary line follows the real failure - re…