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

IDE fails to start - JSON parse error #2544

Open
ondra-novak opened this issue Oct 28, 2024 · 2 comments
Open

IDE fails to start - JSON parse error #2544

ondra-novak opened this issue Oct 28, 2024 · 2 comments
Labels
type: imperfection Perceived defect in any part of project

Comments

@ondra-novak
Copy link

Often i am unable to start IDE with following error
It is random behaviour.

2024-10-28T16:06:29.021Z config ERROR Failed to initialize the CLI configuration. SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at x.getFallbackCliConfig (/home/ondra/arduino-ide/resources/app/lib/backend/main.js:2:763042)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async x.loadCliConfig (/home/ondra/arduino-ide/resources/app/lib/backend/main.js:2:762457)
    at async x.initConfig (/home/ondra/arduino-ide/resources/app/lib/backend/main.js:2:760906)

Daemon path

2024-10-28T16:06:28.996Z daemon INFO Starting daemon from /home/ondra/arduino-ide/resources/app/lib/backend/resources/arduino-cli...

Spawn command OK result:

ondra@nikola:~/arduino-ide$ ./resources/app/lib/backend/resources/arduino-cli config get directories --json
{
  "data": "/home/ondra/.arduino15",
  "downloads": "",
  "user": "/home/ondra/Arduino"
}

(error line :

const { user, data } = JSON.parse(directoriesRaw);
)

@ondra-novak
Copy link
Author

Additional:

I was able to redirect arduino-cli command line and output to a log file, verified that ide is sometime able to start. Following logs record from failed start. Nothing abnormal, still getting JSON parse error (probably a race condition)

snippet of arduino-ide log (time in UTC)

024-10-28T16:54:59.920Z config INFO Loaded CLI configuration: {"board_manager":{"additional_urls":[]}}
2024-10-28T16:54:59.920Z config INFO Loading fallback CLI configuration to get 'directories.data' and 'directories.user'
2024-10-28T16:54:59.929Z config ERROR Failed to initialize the CLI configuration. SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at x.getFallbackCliConfig (/home/ondra/arduino-ide/resources/app/lib/backend/main.js:2:763042)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async x.loadCliConfig (/home/ondra/arduino-ide/resources/app/lib/backend/main.js:2:762457)
    at async x.initConfig (/home/ondra/arduino-ide/resources/app/lib/backend/main.js:2:760906)
2024-10-28T16:54:59.940Z daemon INFO time="2024-10-28T17:54:59+01:00" level=info msg="arduino-cli version 1.0.4"
time="2024-10-28T17:54:59+01:00" level=info msg="Using config file: /home/ondra/.arduinoIDE/arduino-cli.yaml"
time="2024-10-28T17:54:59+01:00" level=info msg="Executing `arduino-cli daemon`"
Daemon is now listening on 127.0.0.1:41445
{"IP":"127.0.0.1","Port":"41445"}
2024-10-28T16:54:59.940Z daemon INFO Daemon is running.
2024-10-28T16:54:59.962Z root INFO Resolve plugins list: 61.8 ms [Finished 0.645 s after backend start]

Captured log redirected from arduino-cli (time in CET - +01:00)

Starting /home/ondra/arduino-ide/resources/app/lib/backend/resources/arduino-cli-2 config dump --json
Starting /home/ondra/arduino-ide/resources/app/lib/backend/resources/arduino-cli-2 config get directories --json
{
  "config": {}
}
Exited: 0
Starting /home/ondra/arduino-ide/resources/app/lib/backend/resources/arduino-cli-2 daemon --port 0 --config-file /home/ondra/.arduinoIDE/arduino-cli.yaml -v
{
  "data": "/home/ondra/.arduino15",
  "downloads": "",
  "user": "/home/ondra/Arduino"
}
Exited: 0
time="2024-10-28T17:54:59+01:00" level=info msg="arduino-cli version 1.0.4"
time="2024-10-28T17:54:59+01:00" level=info msg="Using config file: /home/ondra/.arduinoIDE/arduino-cli.yaml"
time="2024-10-28T17:54:59+01:00" level=info msg="Executing `arduino-cli daemon`"
Daemon is now listening on 127.0.0.1:41445
{"IP":"127.0.0.1","Port":"41445"}

time="2024-10-28T17:54:59+01:00" level=info msg="Checking signature" index=/home/ondra/.arduino15/package_index.json signatureFile=/home/ondra/.arduino15/package_index.json.sig trusted=true
time="2024-10-28T17:54:59+01:00" level=info msg="Loading hardware from: /home/ondra/.arduino15/packages"

Redirection script:

#!/bin/bash
ABSDIR=`dirname "$0"`
echo "Starting $ABSDIR/arduino-cli-2 $*" >> /tmp/arduino-cli.log
$ABSDIR/arduino-cli-2 $* | tee -a /tmp/arduino-cli.log
echo "Exited: $?" >> /tmp/arduino-cli.log

@per1234 per1234 assigned per1234 and unassigned per1234 Oct 28, 2024
@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Oct 28, 2024
@Twilight-Logic

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants