Skip to content

[8.8.0] Prevent NPE crash when updating MODULE.bazel.lock with null `Repo… - #30895

Merged
Wyverald merged 3 commits into
bazelbuild:release-8.8.0from
iancha1992:cp30894
Aug 27, 2026
Merged

[8.8.0] Prevent NPE crash when updating MODULE.bazel.lock with null `Repo…#30895
Wyverald merged 3 commits into
bazelbuild:release-8.8.0from
iancha1992:cp30894

Conversation

@iancha1992

Copy link
Copy Markdown
Member

…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 #24716

PiperOrigin-RevId: 971891689
Change-Id: I405c61d5c6f4d20b9908083099a1e64d7f571350

Description

Motivation

Build API Changes

No

Checklist

  • I have added tests for the new use cases (if any).
  • I have updated the documentation (if applicable).

Release Notes

RELNOTES: None

Commit a671c5e

…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
iancha1992 requested a review from a team as a code owner August 27, 2026 18:07
@iancha1992 iancha1992 added the awaiting-review PR is awaiting review from an assigned reviewer label Aug 27, 2026
@github-actions github-actions Bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. area-Bzlmod Bzlmod-specific PRs, issues, and feature requests labels Aug 27, 2026
@iancha1992
iancha1992 requested review from Wyverald and meteorcloudy and removed request for a team August 27, 2026 18:08
@iancha1992
iancha1992 enabled auto-merge August 27, 2026 18:08
@iancha1992
iancha1992 disabled auto-merge August 27, 2026 18:48
@iancha1992
iancha1992 enabled auto-merge August 27, 2026 18:55
@iancha1992
iancha1992 disabled auto-merge August 27, 2026 18:55
@iancha1992

Copy link
Copy Markdown
Member Author

@Wyverald
Are you okay with this commit? 7cd2536

I added to avoid failure.

@Wyverald

Copy link
Copy Markdown
Member

Looks good, thanks!

@Wyverald
Wyverald added this pull request to the merge queue Aug 27, 2026
Merged via the queue into bazelbuild:release-8.8.0 with commit 322c1a9 Aug 27, 2026
42 checks passed
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Bzlmod Bzlmod-specific PRs, issues, and feature requests team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants