Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODULE file not found, but it exists #23867

Closed
laurentlb opened this issue Oct 4, 2024 · 2 comments
Closed

MODULE file not found, but it exists #23867

laurentlb opened this issue Oct 4, 2024 · 2 comments
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged

Comments

@laurentlb
Copy link
Contributor

Description of the bug:

In some cases, Bazel fails with an error:

fetching local_repository rule //:config~: java.io.IOException: No MODULE.bazel, REPO.bazel, or WORKSPACE file found in /Users/laurent/code/repro2/tmp2/cfg
although the MODULE file does exist there.

I had to use bazel shutdown and start the build again to fix the build error.

Which category does this issue belong to?

External Dependency

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

Repro script:

#! /bin/bash

bazel --version

touch BUILD
cat > MODULE.bazel << EOF
bazel_dep(name = "config")

local_path_override(
     module_name = "config",
     path = "cfg",
)
EOF

mkdir cfg

# Error expected.
bazel build ...
echo

echo 'module(name = "config")' > cfg/MODULE.bazel

# Fails, but shouldn't.
bazel build ...
echo

bazel shutdown

# Succeeds as expected.
bazel build ...

Output:

$ bash ../repro.sh     
bazel 7.2.0
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 67b47b49-6ed0-43b5-845f-ab735c4cc123
ERROR: <builtin>: fetching local_repository rule //:config~: java.io.IOException: No MODULE.bazel, REPO.bazel, or WORKSPACE file found in /Users/laurent/code/repro2/tmp2/cfg
ERROR: Error computing the main repository mapping: error during computation of main repo mapping: No MODULE.bazel, REPO.bazel, or WORKSPACE file found in /Users/laurent/code/repro2/tmp2/cfg
Computing main repo mapping: 

INFO: Invocation ID: 75c6c5b8-42d6-4203-8586-a27a2359234b
ERROR: <builtin>: fetching local_repository rule //:config~: java.io.IOException: No MODULE.bazel, REPO.bazel, or WORKSPACE file found in /Users/laurent/code/repro2/tmp2/cfg
ERROR: Error computing the main repository mapping: error during computation of main repo mapping: No MODULE.bazel, REPO.bazel, or WORKSPACE file found in /Users/laurent/code/repro2/tmp2/cfg
Computing main repo mapping: 

INFO: Invocation ID: 8375d597-96d7-41e5-bed6-6912fa78abed
Starting local Bazel server and connecting to it...
INFO: Invocation ID: d4b55a68-e971-44d5-8bfd-bf37e9d5075b
INFO: Found 0 targets...
INFO: Elapsed time: 13.163s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action

Which operating system are you running Bazel on?

MacOS

What is the output of bazel info release?

release 7.2.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 ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

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

@github-actions github-actions bot added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Oct 4, 2024
@fmeum
Copy link
Collaborator

fmeum commented Oct 4, 2024

Could you try 7.2.1 or later? Should have been fixed: #22687.

@laurentlb
Copy link
Contributor Author

Thanks, it fixes the issue!
Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged
Projects
None yet
Development

No branches or pull requests

5 participants