[8.8.0] Prevent NPE crash when updating MODULE.bazel.lock with null `Repo… - #30895
Merged
Conversation
…RuleId`. When a lockfile contains an entry from before commit 3d60f1c or from a merge conflict resolution that lacks `repoRuleId`, GSON deserializes `RepoSpec` with `repoRuleId = null`. Later, when Bazel updates and writes the lockfile in `BazelLockFileModule.updateLockfile`, serializing `RepoSpec` invokes `repoRuleId.toString()`, which throws an NPE resulting in a Bazel crash. Now we have proper `null`-safety checks in GSON TypeAdapters so that malformed lockfile entries with `null` repoRuleId are cleanly reported. Fixes bazelbuild#24716 PiperOrigin-RevId: 971891689 Change-Id: I405c61d5c6f4d20b9908083099a1e64d7f571350
iancha1992
requested review from
Wyverald and
meteorcloudy
and removed request for
a team
August 27, 2026 18:08
iancha1992
enabled auto-merge
August 27, 2026 18:08
Wyverald
approved these changes
Aug 27, 2026
iancha1992
disabled auto-merge
August 27, 2026 18:48
iancha1992
enabled auto-merge
August 27, 2026 18:55
iancha1992
disabled auto-merge
August 27, 2026 18:55
Member
Author
Member
|
Looks good, thanks! |
Merged
via the queue into
bazelbuild:release-8.8.0
with commit Aug 27, 2026
322c1a9
42 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…RuleId`.
When a lockfile contains an entry from before commit 3d60f1c or from a merge conflict resolution that lacks
repoRuleId, GSON deserializesRepoSpecwithrepoRuleId = null. Later, when Bazel updates and writes the lockfile inBazelLockFileModule.updateLockfile, serializingRepoSpecinvokesrepoRuleId.toString(), which throws an NPE resulting in a Bazel crash.Now we have proper
null-safety checks in GSON TypeAdapters so that malformed lockfile entries withnullrepoRuleId are cleanly reported.Fixes #24716
PiperOrigin-RevId: 971891689
Change-Id: I405c61d5c6f4d20b9908083099a1e64d7f571350
Description
Motivation
Build API Changes
No
Checklist
Release Notes
RELNOTES: None
Commit a671c5e