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.
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.
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.
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.