sparrow
sparrow copied to clipboard
Error parsing JSON
Hello,
I get this error when trying to set up a new hardware wallet, happens with my ledger as well as a brand new coldcard M4. Disabling my firewall didn't help. Any suggestions would be appreciated.
Same problem here with Bitbox02 on Arch Linux. Error log looks like this:
JSON: com.sparrowwallet.sparrow.io.ImportException: Error scanning, check devices are ready at [email protected]/com.sparrowwallet.sparrow.io.Hwi.enumerate(Unknown Source) at [email protected]/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source) at [email protected]/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source) at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
Usually the problem in these cases is that there is a system library missing. Here's what I suggest:
- If you're on Linux, open the Tools > Install Udev Rules dialog and copy out the hwi command. It should look something like
/tmp/hwi-2.1.113352440272729693692.tmp
- If you're on macOS, it will be in
~/.sparrow/hwi/hwi-2.1.1/hwi
- Run this command with the parameter "enumerate", so
/tmp/hwi-2.1.113352440272729693692.tmp enumerate
- You should get an output similar to the following, which tells you what is missing:
[10117] Error loading Python lib '/tmp/_MEIRrDDlR/libpython3.9.so.1.0': dlopen: libcrypt.so.1: cannot open shared object file: No such file or directory
- In this example, the required library was installed by installing
libxcrypt-compat
. You may need to Google for it. Please post feedback here.
Sorry, I meant to share the log. Also I am using Windows 7
2022-07-21 23:02:43,392 ERROR [Thread-171] c.s.s.i.Hwi [null:-1] Error parsing JSON:
com.sparrowwallet.sparrow.io.ImportException: Error scanning, check devices are ready
at [email protected]/com.sparrowwallet.sparrow.io.Hwi.enumerate(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2022-07-21 23:03:11,117 ERROR [Thread-174] c.s.s.i.Hwi [null:-1] Error executing hwi-2.1.1
java.io.IOException: Cannot run program "C:\Users\Justin\AppData\Roaming\Sparrow\hwi\hwi-2.1.116756975614876598699.tmp": CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi.execute(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi.enumerate(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.
Usually the problem in these cases is that there is a system library missing. Here's what I suggest:
1. If you're on Linux, open the Tools > Install Udev Rules dialog and copy out the hwi command. It should look something like `/tmp/hwi-2.1.113352440272729693692.tmp` 2. If you're on macOS, it will be in `~/.sparrow/hwi/hwi-2.1.1/hwi` 3. Run this command with the parameter "enumerate", so `/tmp/hwi-2.1.113352440272729693692.tmp enumerate` 4. You should get an output similar to the following, which tells you what is missing: `[10117] Error loading Python lib '/tmp/_MEIRrDDlR/libpython3.9.so.1.0': dlopen: libcrypt.so.1: cannot open shared object file: No such file or directory` 5. In this example, the required library was installed by installing `libxcrypt-compat`. You may need to Google for it. Please post feedback here.
Thanks for the reply, could I get instructions for that process on Windows 7? I need to install Python 3 to use Sparrow?
I need to install Python 3 to use Sparrow?
No, you don't need to install Python 3. HWI contains it's own Python.
could I get instructions for that process on Windows 7?
Normally the path of Temp folder will be C:\Users<username>\AppData\Local\Temp
You can find it with echo %TEMP%
using cmd
Inside that folder you should find the hwi folder similar to hwi-2.1.113352440272729693692.tmp
From there you can run hwi enumerate
Apologies, on Windows (as of recent releases) HWI is in your Sparrow home folder - in your case, this is C:\Users\Justin\AppData\Roaming\Sparrow\hwi\
Inside that folder you should find the hwi file similar in name to hwi-2.1.1...............tmp
. You should be able to run this file on the command line.
Hi, in my case the enumerate function hangs, I have modified the HWI code to enumerate my BitBox2 in Windows 10 https://github.com/bitcoin-core/HWI/issues/630 Now, I have a working hwi,exe, have modified the hwi path in the config file at C:\Users\username\AppData\Roaming\Sparrow\hwi, but I am still getting this error Error parsing JSON in Sparrow. I think that the hwi.exe is not being executed, I don't see it appear in the tasks admin. It is strange because I have rebuilt sparrow from 1.6.6 tag and it works with the modified config file
@santochibtc The error is probably happening in a command executed after enumerate
. Hwi executes quickly and probably doesn't make it into the Task Manager. Try experimenting with your rebuilt hwi.exe to make sure you can retrieve xpubs etc. You can also look in Hwi.java to see what Sparrow is doing.
Thanks, with the rebuilt hwi.exe and the rebuilt sparrow tag 1.6.6 I can retrieve the xpubs. But with the release 1.6.6 built by you and downloaded from github I am still having the error parsing json. I don't have any change in the source code.
Ok, but you have changed the source in your rebuilt hwi.exe? It looks like the issue lies there and is getting resolved (from reading the issue you linked above).
Yes, I fixed the hwi library and built a new hwi.exe. I modified the path to the hwi exe in the sparrow config file and it didn't work with 1.6.6 release. That is why I compiled the 1.6.6 tag to debug the Sparrow code. To my surprise it worked without changing the code. Why does it work with my compilation of sparrow and not with your release?
There's no reason I can think of that this would be the case. Are you sure of your findings?
I am sure that I have built 1.6.6 tag without changes and that the release and my rebuilt are using the same config file with the new path to the updated hwi.exe.
When I press "Scan again" without the HW connected, the release instantaneously reports "error parsing json", my rebuilt takes some seconds and then says "No hardware wallet found". This is the log 2022-09-21 19:14:19,276 ERROR [Thread-15] c.s.s.i.Hwi [null:-1] Error parsing JSON: com.sparrowwallet.sparrow.io.ImportException: Error scanning, check devices are ready at [email protected]/com.sparrowwallet.sparrow.io.Hwi.enumerate(Unknown Source) at [email protected]/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source) at [email protected]/com.sparrowwallet.sparrow.io.Hwi$EnumerateService$1.call(Unknown Source) at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
Had same issue and couldn't resolve via command line (on Mac OS).
Instead, I just changed to watch-only wallet with zpub w/ derivation and will just it that way. Likely a mac library bug, but Sir Raw may know best.
At least on Linux, this is because the shipped python/hwi depends on libcrypt.1.so
. Arch users can install libxcrypt-compat
.
I haven't tried but I suspect this was resolved in hwi with https://github.com/bitcoin-core/HWI/commit/8d134dfbf9bdb33a6a822f05e8528aa68087b06b, so Sparrow here needs to upgrade to hwi >= 2.2.0.
edit: see also https://github.com/sparrowwallet/sparrow/issues/809 which mentions upgrading hwi to 2.2.0.
Thanks @real-or-random - Sparrow has been upgraded to HWI 2.2.0 as of 68cd3673.
Closing this off as Sparrow v1.7.2 has been released with HWI 2.2.0. Also, as of https://github.com/sparrowwallet/sparrow/commit/0cc9ddba0588953409a4398cdc22b1d7139a0c4f Sparrow will do a better job of displaying/logging errors coming from HWI.
I think this problem came back. I see this with Sparrow 1.7.6:
2023-05-13 18:55:22,340 ERROR Error executing hwi-2.2.1
java.io.IOException: Traceback (most recent call last):
File "hwi.py", line 7, in <module>
File "hwilib/_cli.py", line 304, in main
File "hwilib/_cli.py", line 270, in process_commands
File "hwilib/_cli.py", line 63, in enumerate_handler
File "hwilib/commands.py", line 117, in enumerate
File "hwilib/devices/bitbox02.py", line 184, in enumerate
File "hwilib/devices/bitbox02.py", line 273, in __init__
File "hid.pyx", line 154, in hid.device.open_path
OSError: open failed
[32155] Failed to execute script 'hwi' due to unhandled exception!
at [email protected]/com.sparrowwallet.sparrow.io.Hwi.getProcessOutput(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi.execute(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi.enumerateUsb(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi.enumerate(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi$ScheduledEnumerateService$1.call(Unknown Source)
at [email protected]/com.sparrowwallet.sparrow.io.Hwi$ScheduledEnumerateService$1.call(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Again, installing libxcrypt-compat
on Arch Linux fixes this. https://aur.archlinux.org/packages/sparrow-wallet#comment-912623 reports the same.
I suspect HWI continues to rely on libcrypt.1.so
to be installed, which it appears to be by default on most Linux systems, Arch excluded. Thanks for reporting.
HWI doesn't need libcrypt.1.so
. When I install HWI manually, it works without libcrypt.1.so
, which is by the way a very outdated OpenSSL. It's not exactly reassuring that Sparrow depends on (old) OpenSSL. ;) How do you create these blobs such as https://github.com/sparrowwallet/sparrow/blob/master/src/main/resources/native/linux/x64/hwi
? Could it be the case that these blobs contain very old Python versions?
How do you create these blobs such as
https://github.com/sparrowwallet/sparrow/blob/master/src/main/resources/native/linux/x64/hwi
?
Directly from the HWI release page: https://github.com/bitcoin-core/HWI/releases/download/2.2.1/hwi-2.2.1-linux-amd64.tar.gz - that file is an exact copy of the hwi
executable contained in the binary release.
Sparrow does not depend on OpenSSL in any way - so this is something of a mystery.
Ok, I dug a bit deeper. PyInstaller is supposed to bundle necessary libraries but doesn't bundle this one for good reasons: https://github.com/pyinstaller/pyinstaller/issues/6618
So yeah, if PyInstaller says "wontfix", that's not a bug in Sparrow, but Sparrow packages on affected distros should depend on libxcrypt-compat
(or whatever that package is called). I still wonder why this issue disappeared with 2.2.0 but okay, whatever.
Sparrow does not depend on OpenSSL in any way - so this is something of a mystery.
Sorry, ignore my remark about OpenSSL. libcrypto is not OpenSSL, it's a part of glibc. (For some reason I misremembered the soname of OpenSSL...)
Thanks for digging into this - seems it may affect Fedora as well. I'll add an FAQ on this topic.