Bazel "no such attribute in rule" in CI
Bazel evaluated a rule call and found an attribute name the rule does not declare. This usually happens when a rule signature changed across a Bazel or ruleset version and CI now runs the newer one.
What this error means
A build fails with "no such attribute 'foo' in 'cc_binary' rule" pointing at the BUILD line that set the unknown attribute.
bazel
ERROR: /home/runner/work/app/app/foo/BUILD.bazel:3:9: no such attribute
'linkstatic_deprecated' in 'cc_binary' rule (did you mean 'linkstatic'?)Common causes
The attribute was renamed or removed
A newer Bazel or ruleset dropped or renamed the attribute, so the BUILD file passes a name the rule no longer accepts.
A version drift between local and CI Bazel
CI runs a different Bazel version than local, so a rule signature differs and an accepted attribute becomes unknown.
How to fix it
Use the current attribute name
- Read the "did you mean" hint or the rule docs for the current attribute.
- Rename or remove the unknown attribute in the BUILD file.
- Re-run so the rule accepts the attributes you pass.
foo/BUILD.bazel
cc_binary(
name = "app",
srcs = ["main.cc"],
linkstatic = True,
)Pin Bazel so signatures match
Pin the Bazel version with .bazelversion so local and CI evaluate the same rule signatures.
.bazelversion
7.4.1How to prevent it
- Pin Bazel with .bazelversion so rule signatures are consistent.
- Read migration notes when bumping Bazel or rulesets.
- Fix renamed attributes across all BUILD files in one change.
Related guides
Bazel "no matching toolchains found" in CIFix Bazel "While resolving toolchains for target ...: no matching toolchains found" in CI - no registered too…
Bazel "C++ compilation of rule failed" in CIFix Bazel "C++ compilation of rule failed" in CI - the cc_toolchain ran the compiler and it exited non-zero,…
Bazelisk "could not download Bazel" (.bazelversion) in CIFix Bazelisk "could not download Bazel" in CI - Bazelisk read .bazelversion and failed to fetch that Bazel re…