Skip to content
Latchkey

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

  1. Read the "did you mean" hint or the rule docs for the current attribute.
  2. Rename or remove the unknown attribute in the BUILD file.
  3. 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.1

How 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

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