Skip to content

Load to idea, cause error #344

Description

@huhuang03

open this project in jetbrains idea(with bazel plugin installed). Then in idea's bazel panel, click sync. then the error happens:

Error loading '//:repositories.bzl' for module extensions, requested by /home/th/repo/copybara/copybara/MODULE.bazel:85:37: at /home/th/repo/copybara/copybara/repositories.bzl:17:6: cannot load '//third_party:bazel.bzl': no such file: at /home/th/repo/copybara/copybara/repositories.bzl:17:6: cannot load '//third_party:bazel.bzl': no such file

I have checked the code, yes, the repositories.bzl load the '//third_party:bazel.bzl' which is not exists.

The bazel build //java/com/google/copybara can build success, I asked ai, it says:

What your result shows is simpler:

  - MODULE.bazel references //:repositories.bzl only for async_profiler_repos.
  - b build ... can still succeed because that module extension is apparently not needed for the targets Bazel analyzes/builds in this repo.
  - IntelliJ Bazel sync is doing a broader workspace/module evaluation and ends up loading repositories.bzl, which then fails on the stale import of //third_party:bazel.bzl
  - 


   The closest manual terminal checks for your case are:

  bazelisk mod dep

And the output:

th@th-ubuntu-daily-dev:~/repo/copybara/copybara ((HEAD detached from 447d194))$ b mod deps
WARNING: For repository 'rules_cc', the root module requires module version rules_cc@0.2.16, but got rules_cc@0.2.17 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
ERROR: /home/th/.cache/bazel/_bazel_th/9f24d299cabe99b3d9a0713821731160/external/bazel_jar_jar+/internal/jar_jar.bzl:41:9: name 'JavaInfo' is not defined
ERROR: /home/th/.cache/bazel/_bazel_th/9f24d299cabe99b3d9a0713821731160/external/bazel_jar_jar+/internal/jar_jar.bzl:62:17: name 'JavaInfo' is not defined
ERROR: Error loading '//:repositories.bzl' for module extensions, requested by /home/th/repo/copybara/copybara/MODULE.bazel:85:37: at /home/th/repo/copybara/copybara/repositories.bzl:17:6: cannot load '//third_party:bazel.bzl': no such file: at /home/th/repo/copybara/copybara/repositories.bzl:17:6: cannot load '//third_party:bazel.bzl': no such file
ERROR: Error loading '@@bazel_jar_jar+//internal:non_module_deps.bzl' for module extensions, requested by https://bcr.bazel.build/modules/bazel_jar_jar/0.1.7/MODULE.bazel:9:32: at /home/th/.cache/bazel/_bazel_th/9f24d299cabe99b3d9a0713821731160/external/bazel_jar_jar+/internal/non_module_deps.bzl:1:6: at /home/th/.cache/bazel/_bazel_th/9f24d299cabe99b3d9a0713821731160/external/bazel_jar_jar+/jar_jar.bzl:6:5: compilation of module 'internal/jar_jar.bzl' failed: at /home/th/.cache/bazel/_bazel_th/9f24d299cabe99b3d9a0713821731160/external/bazel_jar_jar+/internal/non_module_deps.bzl:1:6: at /home/th/.cache/bazel/_bazel_th/9f24d299cabe99b3d9a0713821731160/external/bazel_jar_jar+/jar_jar.bzl:6:5: compilation of module 'internal/jar_jar.bzl' failed
<root> (copybara@0)

ERROR: Results may be incomplete as 2 extensions failed.
th@th-ubuntu-daily-dev:~/repo/copybara/copybara ((HEAD detached from 447d194))$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions