Skip to content

[9.1.0] Fix NPE caused by --repo_env with no value set (https://github.com/bazelbuild/bazel/pull/28606)#28641

Merged
iancha1992 merged 1 commit intobazelbuild:release-9.1.0from
bazel-io:cp28606-9.1.0
Feb 26, 2026
Merged

[9.1.0] Fix NPE caused by --repo_env with no value set (https://github.com/bazelbuild/bazel/pull/28606)#28641
iancha1992 merged 1 commit intobazelbuild:release-9.1.0from
bazel-io:cp28606-9.1.0

Conversation

@bazel-io
Copy link
Copy Markdown
Member

This is to address #28605. bazel crashes with NullPointerException in case --repo_env=NON_EXISTENT is used with no value set in user's local environment. It worked in 8.5.1 but doesn't in 9.0.0 so it seems like a regression.

Closes #28606.

PiperOrigin-RevId: 868871905
Change-Id: I0ecd9a4b76b7795e1f00583050aaf343fe930832

Commit b55b69d

This is to address bazelbuild#28605. bazel crashes with `NullPointerException` in case `--repo_env=NON_EXISTENT` is used with no value set in user's local environment. It worked in `8.5.1` but doesn't in `9.0.0` so it seems like a regression.

Closes bazelbuild#28606.

PiperOrigin-RevId: 868871905
Change-Id: I0ecd9a4b76b7795e1f00583050aaf343fe930832
@bazel-io bazel-io added the awaiting-review PR is awaiting review from an assigned reviewer label Feb 11, 2026
@bazel-io bazel-io requested a review from a team as a code owner February 11, 2026 23:33
@bazel-io bazel-io added the awaiting-review PR is awaiting review from an assigned reviewer label Feb 11, 2026
@bazel-io bazel-io requested review from Wyverald, fmeum and katre February 11, 2026 23:33
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively resolves a NullPointerException that occurred when --repo_env was used with an environment variable that was not set. The fix in CommandEnvironment.java correctly adds a null check before attempting to add the variable to the repository environment map. The new test case in bazel_external_repository_test.py is well-designed, accurately reproduces the failure condition, and will prevent future regressions. The changes are clean, targeted, and fully address the reported issue.

@iancha1992 iancha1992 added the team-Configurability platforms, toolchains, cquery, select(), config transitions label Feb 12, 2026
@iancha1992 iancha1992 added this pull request to the merge queue Feb 25, 2026
Merged via the queue into bazelbuild:release-9.1.0 with commit 812045d Feb 26, 2026
46 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Configurability platforms, toolchains, cquery, select(), config transitions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants