Intellij: "Sync failed" when importing project

Created on 11 May 2017  路  11Comments  路  Source: bazelbuild/intellij

This occurs when trying to import a bazel project.

This is displayed in the bazel console:

Syncing project...
Updating VCS...
Running Bazel info...
Command:  info --tool_tag=ijwb:IDEA:community --curses=no --color=no --noexperimental_ui --noprogress_in_terminal_title --

Sync failed

==== TIMING REPORT ====

Sync: 91ms
    BazelInfo: 7ms

Stacktrace:

com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
java.util.concurrent.ExecutionException: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:476)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:455)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
    at com.google.idea.blaze.base.async.FutureUtil$Builder.lambda$run$0(FutureUtil.java:93)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:37)
    at com.google.idea.blaze.base.async.FutureUtil$Builder.run(FutureUtil.java:83)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.doSyncProject(BlazeSyncTask.java:260)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.syncProject(BlazeSyncTask.java:191)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$run$0(BlazeSyncTask.java:158)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:60)
    at com.google.idea.blaze.base.scope.Scope.root(Scope.java:52)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.run(BlazeSyncTask.java:139)
    at com.google.idea.blaze.base.async.executor.BlazeExecutor$2.run(BlazeExecutor.java:99)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:176)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:556)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
    at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:108)
    at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:105)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:108)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:41)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.runBlazeInfo(BlazeInfoRunnerImpl.java:105)
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.lambda$runBlazeInfo$2(BlazeInfoRunnerImpl.java:75)
    ... 6 more

I'm running bazel 0.4.5-homebrew

Most helpful comment

Thank you very much. I set Settings > Other Settings > Bazel Settings = /usr/local/bin/bazel in the IntelliJ IDEA then it worked 馃憤

All 11 comments

Does 'bazel info' fail from the command line also?

Specifically, can you run:
bazel info --tool_tag=ijwb:IDEA:community --curses=no --color=no --noexperimental_ui --noprogress_in_terminal_title --

If it's fine from the command line, perhaps it's the same problem as #18

Running the command in the terminal does work. But I'm not using the IJ bundled JDK, I've used the "Switch IDE boot JDK" feature to set it up with the same JDK as JAVA_HOME.

Are you getting any other exceptions in your logs (Help > Show Log in Files > idea.log.*) or in the Problems view?

2017-05-15 10:27:59,626 [297576168]   WARN - ase.async.process.ExternalTask - Cannot run program "" (in directory "/Users/andyphilipp/Code/test-projects/bazel"): error=2, No such file or directory 
java.io.IOException: Cannot run program "" (in directory "/Users/andyphilipp/Code/test-projects/bazel"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at com.google.idea.blaze.base.async.process.ExternalTask.invokeCommand(ExternalTask.java:221)
    at com.google.idea.blaze.base.async.process.ExternalTask.lambda$run$0(ExternalTask.java:180)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:37)
    at com.google.idea.blaze.base.async.process.ExternalTask.run(ExternalTask.java:173)
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.runBlazeInfo(BlazeInfoRunnerImpl.java:103)
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.lambda$runBlazeInfo$2(BlazeInfoRunnerImpl.java:75)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:108)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:41)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 12 more
2017-05-15 10:27:59,626 [297576168]   WARN - base.scope.scopes.IdeaLogScope - Cannot run program "" (in directory "/Users/andyphilipp/Code/test-projects/bazel"): error=2, No such file or directory 
2017-05-15 10:27:59,627 [297576169]  ERROR - ea.blaze.base.async.FutureUtil - com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1 
java.util.concurrent.ExecutionException: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:476)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:455)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
    at com.google.idea.blaze.base.async.FutureUtil$Builder.lambda$run$0(FutureUtil.java:93)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:37)
    at com.google.idea.blaze.base.async.FutureUtil$Builder.run(FutureUtil.java:83)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.doSyncProject(BlazeSyncTask.java:260)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.syncProject(BlazeSyncTask.java:191)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$run$0(BlazeSyncTask.java:158)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:60)
    at com.google.idea.blaze.base.scope.Scope.root(Scope.java:52)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.run(BlazeSyncTask.java:139)
    at com.google.idea.blaze.base.async.executor.BlazeExecutor$2.run(BlazeExecutor.java:99)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:176)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:556)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
    at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:108)
    at com.google.idea.blaze.base.async.executor.BlazeExecutor$3.call(BlazeExecutor.java:105)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:108)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:41)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.runBlazeInfo(BlazeInfoRunnerImpl.java:105)
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.lambda$runBlazeInfo$2(BlazeInfoRunnerImpl.java:75)
    ... 6 more

Could you check that you have the correct bazel binary selected in Settings > Other Settings > Bazel Settings'?

If so, perhaps try running with IntelliJ's bundled JDK?

Updating the binary location did the trick! Thank you!

Great, good to hear it's working!

Thank you very much. I set Settings > Other Settings > Bazel Settings = /usr/local/bin/bazel in the IntelliJ IDEA then it worked 馃憤

Thank you very much.

Thanks! Very helpful!

In Android Studio 4 @Windows 10 , it doesn't work.
However, you can try to download bazel from https://github.com/bazelbuild/bazel/releases, then change the name ( e.g. bazel-3.5.0-windows-x86_64.exe to bazel.exe ) , put bazel.exe to anywhere you want.
in Android Stuido (after bazel plugin installed), "File"->"Settings"->"Bazel Settings"->"Bazel binary location", change the path to your downloaded bazel.exe
done

Was this page helpful?
0 / 5 - 0 ratings