Monday, October 30, 2017

CLion with Bazel - "Unknown Error" when trying to run the debugger on Ubuntu

I wasted one hour to figure this out, as I'll add another 5 mins to write this up.

If you want to run the debugger on some binary in CLion with Bazel, and just press the Debug button, nothing will happen and a small "Unknown error" toast window will appear at the bottom of your screen. The logs will show a NullPointerException:

java.lang.NullPointerException
        at com.jetbrains.cidr.execution.testing.CidrLauncher.startDebugProcess(CidrLauncher.java:33)
        at com.jetbrains.cidr.execution.CidrCommandLineState.startDebugProcess(CidrCommandLineState.java:30)
        at com.jetbrains.cidr.execution.CidrRunner$1.start(CidrRunner.java:58)
        at com.intellij.xdebugger.impl.XDebuggerManagerImpl.a(XDebuggerManagerImpl.java:217)

To fix this, click on Edit Configurations... and add another before launch task by pressing the green plus button, and select Bazel before-run task from the list. That's it. Happy debugging.

No comments:

Post a Comment