bazelbuild/bazel

bazel crashed due to an internal error. Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:@WORKSPACE'

Open

#20.172 aperta il 13 nov 2023

Vedi su GitHub
 (13 commenti) (1 reazione) (1 assegnatario)Java (4465 fork)batch import
P2help wantedteam-ExternalDepstype: bug

Metriche repository

Star
 (25.384 star)
Metriche merge PR
 (Merge medio 22g 20h) (77 PR mergiate in 30 g)

Descrizione

Description of the bug:

I am setting up a new project to build with bazel, but when I run bazel test //..., I am running into the error 'java.lang.RuntimeException: Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:@WORKSPACE' (requested by nodes '[/Volumes/code/bazel/$$$WORKSPACE_NAME$$$/[external/WORKSPACE]')' where $$$WORKSPACE_NAME$$$ is the name of the workspace and /Volumes/code is a case-sensitive volume on macOS.

I have been unable to pinpoint the trigger cause. I can run bazel test //tests/... and bazel test //:all but not bazel test //tests/...

It is a workspace primarily with python code, that refers to another local workspace using a relative path using local_repository like this

local_repository(
    name = "common",
    path = "../path/to/common",
)

We are using this approach in a transitional period. It looks like it happens when bazel tries to access the 'common' repository.

Reported stack trace was

bazel test //...
Loading: 0 packages loaded
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:@WORKSPACE' (requested by nodes '[/Volumes/code/bazel/SECRET]/[external/WORKSPACE]')
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:633)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:365)
	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.ClassCastException: class com.google.devtools.build.lib.packages.InputFile cannot be cast to class com.google.devtools.build.lib.packages.Rule (com.google.devtools.build.lib.packages.InputFile and com.google.devtools.build.lib.packages.Rule are in unnamed module of loader 'app')
	at com.google.devtools.build.lib.packages.Package.getRule(Package.java:676)
	at com.google.devtools.build.lib.repository.ExternalPackageHelper$ExternalPackageRuleExtractor.processAndShouldContinue(ExternalPackageHelper.java:144)
	at com.google.devtools.build.lib.repository.ExternalPackageHelper.iterateWorkspaceFragments(ExternalPackageHelper.java:118)
	at com.google.devtools.build.lib.repository.ExternalPackageHelper.getRuleByName(ExternalPackageHelper.java:52)
	at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.getRepoRuleFromWorkspace(RepositoryDelegatorFunction.java:444)
	at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.compute(RepositoryDelegatorFunction.java:280)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:562)
	... 7 more

Which category does this issue belong to?

Core

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

I am unable to extract a minimal example (without also extracting proprietary information). I am open to help construct a minimal example or gather additional logs, if I can reproduce the error consistently.

Which operating system are you running Bazel on?

macOS 13.6 (22G120)

What is the output of bazel info release?

release 6.4.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

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

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

Guida contributor