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

Plugin fails to sync after trying to run bazel dump_repo mapping #6807

Closed
imarban opened this issue Sep 27, 2024 · 17 comments
Closed

Plugin fails to sync after trying to run bazel dump_repo mapping #6807

imarban opened this issue Sep 27, 2024 · 17 comments
Assignees
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: PyCharm PyCharm plugin type: bug

Comments

@imarban
Copy link

imarban commented Sep 27, 2024

Problem

The plugin fails during Incremental Syncs with "Error:Could not run Bazel mod dump_repo_mapping". Upon inspecting the logs, this seems to be the relevant stack trace:

2024-09-26 21:31:46,096 [  11173] SEVERE - #com.google.idea.blaze.base.async.FutureUtil - com.google.idea.blaze.base.command.mod.BlazeModException: Unable to get module mapping
java.util.concurrent.ExecutionException: com.google.idea.blaze.base.command.mod.BlazeModException: Unable to get module mapping
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:594)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:573)
	at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91)
	at com.google.idea.blaze.base.async.FutureUtil$Builder.lambda$run$0(FutureUtil.java:109)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:40)
	at com.google.idea.blaze.base.async.FutureUtil$Builder.run(FutureUtil.java:99)
	at com.google.idea.blaze.base.sync.ProjectStateSyncTask.getExternalWorkspaceData(ProjectStateSyncTask.java:253)
	at com.google.idea.blaze.base.sync.ProjectStateSyncTask.getProjectState(ProjectStateSyncTask.java:164)
	at com.google.idea.blaze.base.sync.ProjectStateSyncTask.collectProjectState(ProjectStateSyncTask.java:75)
	at com.google.idea.blaze.base.sync.BlazeSyncManager.lambda$requestProjectSync$1(BlazeSyncManager.java:139)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:57)
	at com.google.idea.blaze.base.scope.Scope.root(Scope.java:33)
	at com.google.idea.blaze.base.sync.BlazeSyncManager.lambda$requestProjectSync$2(BlazeSyncManager.java:116)
	at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTask$0(ProgressiveTaskWithProgressIndicator.java:83)
	at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$4(ProgressiveTaskWithProgressIndicator.java:131)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221)
	at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:49)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98)
	at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$5(ProgressiveTaskWithProgressIndicator.java:131)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:76)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:249)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:227)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:212)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: com.google.idea.blaze.base.command.mod.BlazeModException: Unable to get module mapping
	at com.google.idea.blaze.base.model.ExternalWorkspaceDataProvider.lambda$getExternalWorkspaceData$0(ExternalWorkspaceDataProvider.java:89)
	... 16 more
2024-09-26 21:31:46,099 [  11176] SEVERE - #com.google.idea.blaze.base.async.FutureUtil - PyCharm 2024.2.1  Build #PY-242.21829.153
2024-09-26 21:31:46,099 [  11176] SEVERE - #com.google.idea.blaze.base.async.FutureUtil - JDK: 21.0.3; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2024-09-26 21:31:46,099 [  11176] SEVERE - #com.google.idea.blaze.base.async.FutureUtil - OS: Mac OS X
2024-09-26 21:31:46,100 [  11177] SEVERE - #com.google.idea.blaze.base.async.FutureUtil - Plugin to blame: Bazel for IntelliJ version: 2024.09.10.0.1-api-version-242
2024-09-26 21:31:46,100 [  11177] SEVERE - #com.google.idea.blaze.base.async.FutureUtil - Last Action: Blaze.IncrementalSyncProject
2024-09-26 21:31:46,101 [  11178]   INFO - #com.google.idea.blaze.base.scope.scopes.TimingScope - ==== TIMING REPORT ====
2024-09-26 21:31:46,101 [  11178]   INFO - #com.google.idea.blaze.base.scope.scopes.TimingScope - BazelMod: 667ms
2024-09-26 21:31:46,102 [  11179] SEVERE - #com.google.idea.blaze.base.scope.Scope - com.google.idea.blaze.base.sync.SyncScope$SyncFailedException
com.google.common.base.VerifyException: com.google.idea.blaze.base.sync.SyncScope$SyncFailedException
	at com.google.idea.blaze.base.sync.BlazeSyncManager.lambda$requestProjectSync$1(BlazeSyncManager.java:149)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:57)
	at com.google.idea.blaze.base.scope.Scope.root(Scope.java:33)
	at com.google.idea.blaze.base.sync.BlazeSyncManager.lambda$requestProjectSync$2(BlazeSyncManager.java:116)
	at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTask$0(ProgressiveTaskWithProgressIndicator.java:83)
	at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$4(ProgressiveTaskWithProgressIndicator.java:131)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221)
	at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:49)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98)
	at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$5(ProgressiveTaskWithProgressIndicator.java:131)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:76)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:249)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:227)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:212)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: com.google.idea.blaze.base.sync.SyncScope$SyncFailedException
	at com.google.idea.blaze.base.sync.ProjectStateSyncTask.getExternalWorkspaceData(ProjectStateSyncTask.java:265)
	at com.google.idea.blaze.base.sync.ProjectStateSyncTask.getProjectState(ProjectStateSyncTask.java:164)
	at com.google.idea.blaze.base.sync.ProjectStateSyncTask.collectProjectState(ProjectStateSyncTask.java:75)
	at com.google.idea.blaze.base.sync.BlazeSyncManager.lambda$requestProjectSync$1(BlazeSyncManager.java:139)
	... 33 more

Expected

The plugin syncs successfully by handling the error better and/or fixing the underlying issue.

Which category does this issue belong to?

PyCharm

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

Unsure if this is specific to my repository setup but just going from 2024.08.27.0.1 to 2024.09.10.0.1 breaks it for me.

Which Intellij IDE are you using? Please provide the specific version.

PyCharm 2024.2.3

What programming languages and tools are you using? Please provide specific versions.

Python: 3.9, Bazel: 7.3.1

What Bazel plugin version are you using?

2024.09.10.0.1

Have you found anything relevant by searching the web?

Issue #6664 for which a few commits have merged seems to be in play here.

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

No response

@imarban imarban added awaiting-maintainer Awaiting review from Bazel team on issues type: bug labels Sep 27, 2024
@github-actions github-actions bot added the product: PyCharm PyCharm plugin label Sep 27, 2024
@tpasternak
Copy link
Collaborator

@imarban what's your bazel version?

@imarban
Copy link
Author

imarban commented Sep 27, 2024

Sorry, I forgot to add: 7.3.1

@tpasternak
Copy link
Collaborator

#6769

@tpasternak
Copy link
Collaborator

May I ask you if you have any specifc flags in bazelrc? We are aware of the problem, but can't really reproduce it.

@imarban
Copy link
Author

imarban commented Sep 27, 2024

The issue linked seems to be about bazel info and not bazel mod. I am not entirely sure they are the same.
With regards to bazel flags, I have tried disabling all of them one by one to see if I got a different error from the plugin to no avail.
Also, worth mentioning that if I run the command printed by the plugin in the Bazel -> Sync Tool Window on my own, then it succeeds.

@tpasternak
Copy link
Collaborator

Interesting, sorry for this obvious recommendation, but can you please double-check if you set the right bazel excecutable in settings?

@imarban
Copy link
Author

imarban commented Sep 27, 2024

I dug more and found another piece of stack trace that is relevant:

2024-09-26 21:19:58,299 [ 411179]   WARN - #com.google.idea.blaze.base.model.ExternalWorkspaceDataProvider - Unable to run blaze mod dump_repo_mapping
java.util.concurrent.ExecutionException: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 3 column 2 path $
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:594)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:573)
	at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91)
	at com.google.idea.blaze.base.model.ExternalWorkspaceDataProvider.getCachedExternalWorkspaceData(ExternalWorkspaceDataProvider.java:119)
	at com.google.idea.blaze.base.model.ExternalWorkspaceDataProvider.lambda$getExternalWorkspaceData$0(ExternalWorkspaceDataProvider.java:87)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:76)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:249)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:227)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:212)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 3 column 2 path $
	at com.google.gson.JsonParser.parseReader(JsonParser.java:76)
	at com.google.gson.JsonParser.parseString(JsonParser.java:51)
	at com.google.idea.blaze.base.command.mod.BlazeModRunnerImpl.lambda$dumpRepoMapping$3(BlazeModRunnerImpl.java:70)
	at com.google.common.util.concurrent.AbstractTransformFuture$TransformFuture.doTransform(AbstractTransformFuture.java:253)
	at com.google.common.util.concurrent.AbstractTransformFuture$TransformFuture.doTransform(AbstractTransformFuture.java:243)
	at com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:124)
	... 13 more
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 3 column 2 path $
	at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1659)
	at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1465)
	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:551)
	at com.google.gson.stream.JsonReader.peek(JsonReader.java:433)
	at com.google.gson.JsonParser.parseReader(JsonParser.java:71)
	... 18 more
2024-09-26 21:19:58,299 [ 411179] SEVERE - #com.google.idea.blaze.base.async.FutureUtil - com.google.idea.blaze.base.command.mod.BlazeModException: Unable to get module mapping
java.util.concurrent.ExecutionException: com.google.idea.blaze.base.command.mod.BlazeModException: Unable to get module mapping
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:594)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:573)
	at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91)
	at com.google.idea.blaze.base.async.FutureUtil$Builder.lambda$run$0(FutureUtil.java:109)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:40)
	at com.google.idea.blaze.base.async.FutureUtil$Builder.run(FutureUtil.java:99)
	at com.google.idea.blaze.base.sync.ProjectStateSyncTask.getExternalWorkspaceData(ProjectStateSyncTask.java:253)
	at com.google.idea.blaze.base.sync.ProjectStateSyncTask.getProjectState(ProjectStateSyncTask.java:164)
	at com.google.idea.blaze.base.sync.ProjectStateSyncTask.collectProjectState(ProjectStateSyncTask.java:75)
	at com.google.idea.blaze.base.sync.BlazeSyncManager.lambda$requestProjectSync$1(BlazeSyncManager.java:139)
	at com.google.idea.blaze.base.scope.Scope.push(Scope.java:57)
	at com.google.idea.blaze.base.scope.Scope.root(Scope.java:33)
	at com.google.idea.blaze.base.sync.BlazeSyncManager.lambda$requestProjectSync$2(BlazeSyncManager.java:116)
	at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTask$0(ProgressiveTaskWithProgressIndicator.java:83)
	at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$4(ProgressiveTaskWithProgressIndicator.java:131)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221)
	at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:49)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98)
	at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$5(ProgressiveTaskWithProgressIndicator.java:131)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:76)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:249)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:227)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:212)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: com.google.idea.blaze.base.command.mod.BlazeModException: Unable to get module mapping
	at com.google.idea.blaze.base.model.ExternalWorkspaceDataProvider.lambda$getExternalWorkspaceData$0(ExternalWorkspaceDataProvider.java:89)
	... 16 more

It seems there is an issue reading the output of bazel mod as it's not proper JSON.

I'm trying to understand if I can influence the output of bazel mod to be JSON but I think the plugin should fall back to the previous behavior where this was not enabled if a crash is detected.

@tpasternak
Copy link
Collaborator

As a workaround, please double-press shift, find Registry there and disable bazel.read.external.workspace.data. We'll fix the issue next week

cc @mtoader any ideas why this could happen?

@tpasternak
Copy link
Collaborator

nvm, that might be a generic issue in the process spawner, maybe we don't wait until whole output is printed

@imarban
Copy link
Author

imarban commented Sep 27, 2024

Great! The feature flag works perfectly :). I can confirm, this is happening because we augment the info printed by Bazel, hence it can't be parsed as JSON by the plugin. It's an edge case for the plugin to consider, though.

@mtoader
Copy link
Contributor

mtoader commented Sep 27, 2024

How is the info augmented? The scraper there requires the proper json output from the command though.

As a meta issue. bazel mod failures should not break the whole sync. I'll see how I can add that.

@imarban
Copy link
Author

imarban commented Sep 27, 2024

We append a string that helps with debugging (IMO we shouldn't do it, and can look into removing it). But yeah, a failure from bazel mod or parsing the output shouldn't break the whole sync process.

@tpasternak
Copy link
Collaborator

tpasternak commented Sep 27, 2024

@imarban so I don't think we can correctly handle that. We can have better recovery ofc. I would recommend you to push the augmented data to stderr, or skip it for this case. Without that you won't be able to use external label completions - one of our greatest features developed recently by @mtoader :)

@mtoader
Copy link
Contributor

mtoader commented Sep 27, 2024

I'm adding silent failures now but the parsing is a different story.

@imarban For background:

  • in order to be able to resolve/complete labels that refer into external repositories added by bzlmod the plugin needs a map of visible repo names to actual repo names.
  • the only way to get that reliably is to ask bazel
  • you ask bazel using the bazel mod dump_repo_mapping incantation
  • that command outputs json on stdout (I think bazel mod Is a newish command so structures json on the output is newish in bazel cmd output world).
  • we need to parse that to be able to know what @rules_go/<caret> refers to and trying to complete at the caret there for example.

So augmentation is probably a no-no in this case.

@tpasternak
Copy link
Collaborator

@mtoader no hurry, we have a workaround

@imarban
Copy link
Author

imarban commented Sep 27, 2024

Yeah, not much the plugin can do if the output does not adhere to the output format that you would get from standard bazel. I can fix that for our setup.

Thanks for working on silent failures :) - I think printing a WARN message indicating that external repositories completion won't be available would be ideal.

@mtoader
Copy link
Contributor

mtoader commented Sep 27, 2024

@tpasternak PR is up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: PyCharm PyCharm plugin type: bug
Projects
None yet
Development

No branches or pull requests

4 participants