Skip to content

[9.0.0] Can't define attributes for repository rules that should only be reserved for build rules #28450

@michaelm-openai

Description

@michaelm-openai

Description of the bug:

Attributes such as repository_ctx.attr.visibility were removed, but it's not possible to explicitly define an attribute with those names:

Error in repository_rule: There is already a built-in attribute 'visibility' which cannot be overridden

Which category does this issue belong to?

Rules API

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Define a rule such as:

repository_rule(
    implementation = _impl,
    local = True,
    attrs = {
        "visibility": attr.string_list(default = []),
    },
)

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?


If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

Initial discovery and report
https://bazelbuild.slack.com/archives/CA31HN1T3/p1769277220642989?thread_ts=1769200517.959609&cid=CA31HN1T3

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    team-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: buguntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions