`JsonReaderException` when running `bloop projects`
See original GitHub issueI’m setting up a new laptop and have been having issues using Bloop, both on the command line and through IntelliJ. Both running bloop projects
or loading the project via IntelliJ on any Scala project I’ve tried results in the same error:
❯ bloop projects
bloop.data.Project$ProjectReadException: Failed to load project from /Users/clayton.sayer/code/inbox/service-inbox-ingestion/.bloop/root.json
at bloop.data.Project$.fromBytesAndOrigin(Project.scala:214)
at bloop.engine.BuildLoader$.loadProject(BuildLoader.scala:237)
at bloop.engine.BuildLoader$.$anonfun$loadBuildIncrementally$3(BuildLoader.scala:57)
at monix.eval.internal.TaskRunLoop$.monix$eval$internal$TaskRunLoop$$loop$1(TaskRunLoop.scala:187)
at monix.eval.internal.TaskRunLoop$RestartCallback$1.onSuccess(TaskRunLoop.scala:119)
at monix.eval.Task$.$anonfun$forkedUnit$2(Task.scala:1463)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[E] Failed to load project from /Users/clayton.sayer/code/inbox/service-inbox-ingestion/.bloop/contract-test-inbox-service-test.json
Caused by: com.github.plokhotnyuk.jsoniter_scala.core.JsonReaderException: expected '{', offset: 0x00001f45, buf:
+----------+-------------------------------------------------+------------------+
| | 0 1 2 3 4 5 6 7 8 9 a b c d e f | 0123456789abcdef |
+----------+-------------------------------------------------+------------------+
| 00001f20 | 20 20 20 20 5d 2c 0a 20 20 20 20 20 20 20 20 20 | ],. |
| 00001f30 | 20 20 20 22 72 75 6e 74 69 6d 65 43 6f 6e 66 69 | "runtimeConfi |
| 00001f40 | 67 22 20 3a 20 5b 0a 20 20 20 20 20 20 20 20 20 | g" : [. |
| 00001f50 | 20 20 20 5d 2c 0a 20 20 20 20 20 20 20 20 20 20 | ],. |
| 00001f60 | 20 20 22 63 6c 61 73 73 70 61 74 68 22 20 3a 20 | "classpath" : |
+----------+-------------------------------------------------+------------------+
In each of these projects it fails on project.platform.runtimeConfig
, which it looks like it’s assuming will be a JSON object when it’s actually an empty array.
Replacing these empty arrays with the following seems to fix bloop command line, but trying to re-import the project in IntelliJ overwrites the dotfiles, re-breaking the runtimeConfig
:
"runtimeConfig" : {
"options": []
},
My system info:
❯ java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.275-b01, mixed mode)
❯ bloop about
bloop v1.4.5
Using Scala v2.12.8 and Zinc v1.3.0-M4+45-d4354be3
Running on Java JDK v1.8.0_275 (/Users/clayton.sayer/Library/Java/JavaVirtualMachines/adopt-openjdk-1.8.0_275/Contents/Home/jre)
-> Supports debugging user code, Java Debug Interface (JDI) is available.
Maintained by the Scala Center (Jorge Vicente Cantero, Martin Duhem)
❯ coursier --version
2.0.7
❯ scala --version
Scala code runner version 2.13.4 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc.
❯ sbt --version
[info] 0.13.18
sbt script version: 1.4.4
IntelliJ IDEA 2020.3 (Ultimate Edition) Build #IU-203.5981.155, built on November 30, 2020 Scala plugin 2020.3.16 MacOS Catalina 10.15.7
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
JsonReaderException when importing Bloop project on 2020.3
bloop projects bloop.data.Project$ProjectReadException: Failed to load project from /Users/clayton.sayer/code/inbox/service-inbox-ingestion/.bloop/root.json ...
Read more >VSCode cannot connect to bloop #396 - scalameta/metals
I have VSC with this extension and running Metals: Import build ends up ... I tried to create custom bloop.py and execute it...
Read more >scalacenter/bloop - Gitter
i.e. keep running Bloop server on JDK11 but have it invoke javac from JDK16. Tom. @tomprimozic ... When I run sbt bloopInstall on...
Read more >Bloop · Compile, test and run Scala code fast
The following page explains how to get Bloop installed in your machine and how you can export your current project build to Bloop....
Read more >Bloop | Metals - Scalameta
Bloop is a compile server for Scala that. ... To manually tell Metals to connect with Bloop, run the "Connect to build server"...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@clayton-sayer-hs I just realised you could also workaround it by:
bloop.sbt
file to project, that just adds the bloop plugin:addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.6")
sbt bloopInstall
to generate the configuration file that should be picked correctly by BloopGood to know that the problem only affects sbt 0.13. For all our Play 2.6+ services I’ll try to get them updated to sbt 1.x, but we have a few services that are unfortunately still on Scala 2.11/Play 2.5 which requires sbt 0.13. Updating them is in the works but won’t be for a couple months.
In the mean time, there’s the ticket open with JetBrains that I’ve linked to this ticket, and the PR that fixes the issue, so they can update the plugin on their side. I can also just import the projects into IntelliJ as sbt until a fix comes out.
Thanks so much for the help Tomasz!