Skip to content

fix name collision in java_info#395

Closed
Nadav Wexler (nadavwe) wants to merge 2 commits into
JetBrains:261from
nadavwe:patch-1
Closed

fix name collision in java_info#395
Nadav Wexler (nadavwe) wants to merge 2 commits into
JetBrains:261from
nadavwe:patch-1

Conversation

@nadavwe

@nadavwe Nadav Wexler (nadavwe) commented May 12, 2026

Copy link
Copy Markdown

Hi,
using the bazel ij plugin with bzlmod using bazel 7.7 with a WORKSPACE and basically empty MODULE.bazel, I got this error (redacted specific names):

 file 'external/my_repo/path/to/proto/materialized_api_proto.jdeps' is generated by these conflicting actions:
    Label: @@my_repo//path/to/proto:api_proto_java, @@my_repo//path/to/proto:api_proto
    Aspects: [//.bazelbsp/aspects:core.bzl%bsp_target_info_aspect], [@@my_repo//path/to/proto/rules:java_proto_library.bzl%_java_proto_aspect,//.bazelbsp/aspects:core.bzl%bsp_target_info_aspect]
    RuleClass: java_proto_library_compat rule, proto_library rule
    JavaActionClass: class com.google.devtools.build.lib.analysis.actions.StarlarkAction
    Configuration: e2de5d7b3a1a72d9394a19cd59434b09ebdc723b8477fc93c33c67836047b38a
    Mnemonic: IJBazelPluginMaterializeJdeps
    Action key: 20f14e6e9945ef482ffdc49d15d83137e039e7bbbf6264cf7c0447b3c145a1b8, e6fd7a46fca35e3590c9e6881ff4364334b230dce651f92d032f935d69ed1606
    Progress message: (IntelliJ Bazel plugin) Materializing jdeps <generated file external/my_repo/path/to/proto/api_proto.jdeps>
    Action describeKey: (IntelliJ Bazel plugin) Materializing jdeps <generated file external/my_repo/path/to/proto/api_proto.jdeps>
      Environment variable: BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
      Environment variable: PATH=/bin:/usr/bin:/usr/local/bin
      Argument: /bin/bash
      Argument: -c
      Argument: 'cp '\''bazel-out/darwin_arm64-fastbuild/bin/external/my_repo/path/to/proto/api_proto.jdeps'\''
    '\''bazel-out/darwin_arm64-fastbuild/bin/external/my_repo/path/to/proto/materialized_api_proto.jdeps'\'''
      Output paths mode: OFF
    PrimaryInput: File:[[<execution_root>]bazel-out/darwin_arm64-fastbuild/bin]external/my_repo/path/to/proto/api_proto.jdeps
    PrimaryOutput: File:[[<execution_root>]bazel-out/darwin_arm64-fastbuild/bin]external/my_repo/path/to/proto/materialized_api_proto.jdeps
    Owner information: @@my_repo//path/to/proto:api_proto_java#//.bazelbsp/aspects:core.bzl%bsp_target_info_aspect ConfiguredTargetKey{label=@@my_repo//path/to/proto:api_proto_java,
    config=BuildConfigurationKey[e2de5d7b3a1a72d9394a19cd59434b09ebdc723b8477fc93c33c67836047b38a]} {}, [@@my_repo//path/to/proto:api_proto#@@my_repo//path/to/proto/rules:java_proto_library.bzl%_java_proto_aspect
    ConfiguredTargetKey{label=@@my_repo//path/to/proto:api_proto, config=BuildConfigurationKey[e2de5d7b3a1a72d9394a19cd59434b09ebdc723b8477fc93c33c67836047b38a]} {}]#//.bazelbsp/aspects:core.bzl%bsp_target_info_aspect
    ConfiguredTargetKey{label=@@my_repo//path/to/proto:api_proto, config=BuildConfigurationKey[e2de5d7b3a1a72d9394a19cd59434b09ebdc723b8477fc93c33c67836047b38a]} {}
    MandatoryInputs: are equal

a simple addition of the original target seem to fix the problem.
I'm not sure if there are other places that depend on this name... so this is more of a bug report rather than a solution.
Thanks!

@tboernerapex

Copy link
Copy Markdown

I made a similar change that was rejected: #391 (comment)

@aehlig

Copy link
Copy Markdown
Member

I believe the underlying issue is fixed by c9752e0

That commit will also be cherry-picked to 261 soon.

@nadavwe

Copy link
Copy Markdown
Author

oh, great, thanks!
I'll be waiting for the nightly build 🌃

@nadavwe

Copy link
Copy Markdown
Author

hey Klaus Aehlig (@aehlig), i'm using bazel plugin version 2026.1.2-nightly.86+35f1f578998bc.
it looks like the hash is not specific enough and I still get a similar error:

ile 'external/my_repo/path/to/proto/materialized_1053981129_api_proto.jdeps' is generated by these conflicting actions:
  Label: @@my_repo//path/to/proto:api_proto_java, @@my_repo//path/to/proto:api_proto
  Aspects: [//.bazelbsp/aspects:core.bzl%bsp_target_info_aspect], [@@my_repo//path/to/proto/rules:java_proto_library.bzl%_java_proto_aspect,//.bazelbsp/aspects:core.bzl%bsp_target_info_aspect]
  RuleClass: java_proto_library_compat rule, proto_library rule
  JavaActionClass: class com.google.devtools.build.lib.analysis.actions.StarlarkAction
  Configuration: e2de5d7b3a1a72d9394a19cd59434b09ebdc723b8477fc93c33c67836047b38a
  Mnemonic: IJBazelPluginMaterializeJdeps
  Action key: 3fd3d5053429dd34a0fd60b6616361c2766dba6732729532064b7a52d85a8492, 246c86d93983bfb6e75744bf9fa35d0c1cb9e1bed33d765aae3ac734eeca58d7
  Progress message: (IntelliJ Bazel plugin) Materializing jdeps <generated file external/my_repo/path/to/proto/api_proto.jdeps>
  Action describeKey: (IntelliJ Bazel plugin) Materializing jdeps <generated file external/my_repo/path/to/proto/api_proto.jdeps>
    Environment variable: BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
    Environment variable: PATH=/bin:/usr/bin:/usr/local/bin
    Argument: /bin/bash
    Argument: -c
    Argument: 'cp '\''bazel-out/darwin_arm64-fastbuild/bin/external/my_repo/path/to/proto/api_proto.jdeps'\'' '\''bazel-out/darwin_arm64-fastbuild/bin/external/my_repo/path/to/proto/materialized_1053981129_api_proto.jdeps'\'''
    Output paths mode: OFF
  PrimaryInput: File:[[<execution_root>]bazel-out/darwin_arm64-fastbuild/bin]external/my_repo/path/to/proto/api_proto.jdeps
  PrimaryOutput: File:[[<execution_root>]bazel-out/darwin_arm64-fastbuild/bin]external/my_repo/path/to/proto/materialized_1053981129_api_proto.jdeps
  Owner information: @@my_repo//path/to/proto:api_proto_java#//.bazelbsp/aspects:core.bzl%bsp_target_info_aspect ConfiguredTargetKey{label=@@my_repo//path/to/proto:api_proto_java,
  config=BuildConfigurationKey[e2de5d7b3a1a72d9394a19cd59434b09ebdc723b8477fc93c33c67836047b38a]} {}, [@@my_repo//path/to/proto:api_proto#@@my_repo//path/to/proto/rules:java_proto_library.bzl%_java_proto_aspect
  ConfiguredTargetKey{label=@@my_repo//path/to/proto:api_proto, config=BuildConfigurationKey[e2de5d7b3a1a72d9394a19cd59434b09ebdc723b8477fc93c33c67836047b38a]} {}]#//.bazelbsp/aspects:core.bzl%bsp_target_info_aspect
  ConfiguredTargetKey{label=@@my_repo//path/to/proto:api_proto, config=BuildConfigurationKey[e2de5d7b3a1a72d9394a19cd59434b09ebdc723b8477fc93c33c67836047b38a]} {}
  MandatoryInputs: are equal
  Outputs: are equal```

@aehlig

Copy link
Copy Markdown
Member

hey Klaus Aehlig (@aehlig), i'm using bazel plugin version 2026.1.2-nightly.86+35f1f578998bc. it looks like the hash is not specific enough and I still get a similar error: [...]

Nadav Wexler (@nadavwe) Can you share a reproduction case (can be something artificial). I failed to reproduce that conflict and I have no idea how to construct an example where the actions generated by the aspect for the different targets do not qualify as shared action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants