Skip to content

Starlark build setting invoking go_context throws an exception #12610

@fmeum

Description

@fmeum

Description of the problem:

Bazel fails with java.lang.IllegalStateException: method invocation returned null: toolchains() when invoking rules_go's go_context from a Starlark build setting rule.

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

I have created a minimal example as this gist. If the line go_context(ctx) is replaced with pass, the build succeeds without an exception. I suspect that rules_go is not really needed to trigger the exception here, but don't know enough about toolchains to minimize this example further.

I found this example while trying to create a config setting that would automatically generate code based on its current value.

What operating system are you running Bazel on?

Linux

What's the output of bazel info release?

release 3.7.1

Have you found anything relevant by searching the web?

Unfortunately not.

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

See https://gist.github.com/fmeum/86bd43948210ba2fc9fb64f6a3a3f6af#file-trace for the trace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions