Skip to content

bazel mod tidy fails when nothing changes #21651

@tyler-french

Description

@tyler-french

Description of the bug:

MODULE.bazel is correct, I then run bazel mod tidy and get an error:

% bazel mod --enable_bzlmod tidy       
ERROR: Unexpected error while running buildozer: Process exited with status 3:
. Type 'bazel help mod' for syntax and help.

Next, I mess up the formatting (but not the syntax), and run bazel mod tidy again, and it succeeds:

% bazel mod --enable_bzlmod tidy 

Next, I run it again, and Bazel crashes

% bazel mod --enable_bzlmod tidy
 checking cached actions
    Fetching repository @@bazel_tools; starting
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'com.google.devtools.build.lib.bazel.bzlmod.BazelDepGraphValue$$Lambda/0x0000000800590400@11c76f5f' (requested by nodes 'com.google.devtools.build.lib.bazel.bzlmod.BazelModTidyValue$$Lambda/0x0000000800593800@5733c27d')
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:550)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:414)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.NullPointerException: null value in entry: googleapis=null
        at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33)
        at com.google.common.collect.ImmutableMapEntry.<init>(ImmutableMapEntry.java:54)
        at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:341)
        at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:450)
        at com.google.devtools.build.lib.bazel.bzlmod.Module.getRepoMappingWithBazelDepsOnly(Module.java:67)
        at com.google.devtools.build.lib.bazel.bzlmod.BazelDepGraphFunction.getExtensionUsagesById(BazelDepGraphFunction.java:233)
        at com.google.devtools.build.lib.bazel.bzlmod.BazelDepGraphFunction.compute(BazelDepGraphFunction.java:126)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:461)
        ... 7 more

This will continue with all --enable_bzlmod builds until MODULE.bazel.lock is deleted

Which category does this issue belong to?

No response

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

See description

Which operating system are you running Bazel on?

Linux AMD 64

What is the output of bazel info release?

% bazel info release Starting local Bazel server and connecting to it... INFO: Invocation ID: f7b2a282-a126-4ed2-9b9b-a7eab1906e22 release 7.1.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 HEAD ?

Internal Uber codebase

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

https://github.com/bazelbuild/bazel/pull/21265/files

Have you found anything relevant by searching the web?

No response

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

No response

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)area-BzlmodBzlmod-specific PRs, issues, and feature requeststeam-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.type: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions