question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash when referencing "--action_env" command line option in settings parameter in transition implementation

See original GitHub issue

Description of the bug:

I need to modify the --action_env settings when transitioning, but when I access them in my transition implementation like this

... = settings["//command_line_option:action_env"]

Bazel crashes with this internal error:

Starting local Bazel server and connecting to it...
Loading: 
Loading: 0 packages loaded
FATAL: bazel crashed due to an internal error. Printing stack trace:
net.starlark.java.eval.Starlark$UncheckedEvalException: IllegalArgumentException thrown during Starlark evaluation (//action-env-bug:foo.bzl)
	at <starlark>._foo_transition_impl(/usr/local/google/home/nmosier/tmp/bazel-bug/action-env-bug/foo.bzl:1)
Caused by: java.lang.IllegalArgumentException: invalid Starlark value: class com.google.common.collect.ImmutableEntry
	at net.starlark.java.eval.Starlark.checkValid(Starlark.java:112)
	at net.starlark.java.eval.StarlarkList.checkElemsValid(StarlarkList.java:176)
	at net.starlark.java.eval.StarlarkList.copyOf(StarlarkList.java:170)
	at net.starlark.java.eval.Starlark.fromJava(Starlark.java:188)
	at net.starlark.java.eval.EvalUtils.index(EvalUtils.java:456)
	at net.starlark.java.eval.Eval.evalIndex(Eval.java:718)
	at net.starlark.java.eval.Eval.eval(Eval.java:493)
	at net.starlark.java.eval.Eval.evalBinaryOperator(Eval.java:532)
	at net.starlark.java.eval.Eval.eval(Eval.java:479)
	at net.starlark.java.eval.Eval.evalCall(Eval.java:622)
	at net.starlark.java.eval.Eval.eval(Eval.java:489)
	at net.starlark.java.eval.Eval.exec(Eval.java:271)
	at net.starlark.java.eval.Eval.execStatements(Eval.java:82)
	at net.starlark.java.eval.Eval.execFunctionBody(Eval.java:66)
	at net.starlark.java.eval.StarlarkFunction.fastcall(StarlarkFunction.java:191)
	at net.starlark.java.eval.Starlark.fastcall(Starlark.java:619)
	at com.google.devtools.build.lib.analysis.config.StarlarkDefinedConfigTransition$RegularTransition.evaluate(StarlarkDefinedConfigTransition.java:360)
	at com.google.devtools.build.lib.analysis.starlark.FunctionTransitionUtil.applyAndValidate(FunctionTransitionUtil.java:98)
	at com.google.devtools.build.lib.analysis.starlark.StarlarkRuleTransitionProvider$FunctionPatchTransition.patch(StarlarkRuleTransitionProvider.java:186)
	at com.google.devtools.build.lib.analysis.config.transitions.PatchTransition.apply(PatchTransition.java:75)
	at com.google.devtools.build.lib.analysis.config.transitions.ComposingTransition.apply(ComposingTransition.java:68)
	at com.google.devtools.build.lib.analysis.config.ConfigurationResolver.applyStarlarkTransition(ConfigurationResolver.java:505)
	at com.google.devtools.build.lib.analysis.config.ConfigurationResolver.applyTransitionWithoutSkyframe(ConfigurationResolver.java:440)
	at com.google.devtools.build.lib.skyframe.SkyframeExecutor.getConfigurations(SkyframeExecutor.java:2086)
	at com.google.devtools.build.lib.analysis.config.ConfigurationResolver.getConfigurationsFromExecutor(ConfigurationResolver.java:584)
	at com.google.devtools.build.lib.analysis.AnalysisUtils.getTargetsWithConfigs(AnalysisUtils.java:193)
	at com.google.devtools.build.lib.analysis.BuildView.update(BuildView.java:245)
	at com.google.devtools.build.lib.buildtool.AnalysisPhaseRunner.runAnalysisPhase(AnalysisPhaseRunner.java:217)
	at com.google.devtools.build.lib.buildtool.AnalysisPhaseRunner.execute(AnalysisPhaseRunner.java:129)
	at com.google.devtools.build.lib.buildtool.BuildTool.buildTargets(BuildTool.java:198)
	at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:443)
	at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:411)
	at com.google.devtools.build.lib.runtime.commands.BuildCommand.exec(BuildCommand.java:103)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:585)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:231)
	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:550)
	at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:614)
	at io.grpc.Context$1.run(Context.java:579)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

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

action-env-bug.zip

$ unzip action-env-bug
$ cd action-env-bug
$ bazel build bin # SUCCESS
$ bazel build --action_env="X=1" bin # CRASH

Which operating system are you running Bazel on?

Linux (Debian)

What is the output of bazel info release?

release 5.2.0

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 master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

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

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nmosiercommented, Jul 19, 2022

That’s the same error I get too.

0reactions
aiutocommented, Sep 19, 2022

This may be fixed at head. We’re looking into backporting the fix to 5.x

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception in a transition in a custom container view controller
Hello,. I have a crash report of an app running on an iPhone 7 indicating that an exception has been thrown by the...
Read more >
CRaSH Reference Guide
Simple command; Sub commands; Java commands; Command line annotations ... Evaluating commands; Passing options and arguments; Options and ...
Read more >
config | Bazel
This is a top-level module for creating configuration transitions and build setting ... Whether or not this build setting is callable on the...
Read more >
ChangeLog - crash
Without the patch, the "--kaslr=<offset>" command line option is required. ... (ramin.blackhat@gmail.com) - Implement support for ARM64 kernels that are ...
Read more >
Chapter 18. Configuring kdump on the command line
You can either specify the crashkernel= value or configure the auto option. The crashkernel=auto parameter reserves memory automatically, based on the total ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found