Arduino-cli showing error: panic: runtime error: invalid memory address or nil pointer dereference

I have been starting using arduino-cli (using the bash terminal in visual studio code), and compiled and uploaded several old sketches without any issues. Then I tried to compile sketches with 3rd party libraries and updated my .yaml file for that.
After trying to compile one sketch with a library that was not found I just get this error (does not matter which command or sketch i tried to use):

$ arduino-cli update
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x54bb22]

goroutine 1 [running]:*Path).Join(0x0, 0xc0004db6d8, 0x1, 0x1, 0x0)
        /github/home/go/pkg/mod/ +0x52, 0x22, 0x7)
        /__w/arduino-cli/arduino-cli/configuration/directories.go:44 +0x18f*PackageManager).LoadHardware(0xc0002f2080, 0xc0003e6700, 0x0)
        /__w/arduino-cli/arduino-cli/arduino/cores/packagemanager/loader.go:33 +0x2d, 0xc0000340d0, 0xdffe00, 0xc0002f4001, 0xc0002e60d0, 0xc000269988)
        /__w/arduino-cli/arduino-cli/commands/instances.go:635 +0x893, 0xc0000340d0, 0xc0004dbad8, 0xc0002f4040, 0xc0002e60d0, 0x400, 0x203000000000000, 0x50)
        /__w/arduino-cli/arduino-cli/commands/instances.go:134 +0x5c, 0x50, 0x48)
        /__w/arduino-cli/arduino-cli/cli/instance/instance.go:47 +0xd1
        /__w/arduino-cli/arduino-cli/cli/instance/instance.go:31, 0x17244e8, 0x0, 0x0)
        /__w/arduino-cli/arduino-cli/cli/update/update.go:52 +0x3e*Command).execute(0xc0002a4000, 0x17244e8, 0x0, 0x0, 0xc0002a4000, 0x17244e8)
        /github/home/go/pkg/mod/ +0x2b1*Command).ExecuteC(0xc0001badc0, 0x0, 0xd6b0a0, 0xc00003c0b8)
        /github/home/go/pkg/mod/ +0x350*Command).Execute(...)
        /__w/arduino-cli/arduino-cli/main.go:31 +0x3d

i know there are questions with the same error, but those were caused by a particular sketch, I repeat myself maybe, but right now i cannot run any command on arduino-cli (not even arduino-cli update)

I have a windows 10 laptop and arduino 1.8.15 installed. My arduino IDE is fine and it works normally, the problem i am facing is with the arduino-cli.

is there any way to refresh the arduino-cli? I dont think I have to reinstall the arduino IDE.

Thank you very much in advance.

here my arduino-cli.yaml

  port: "50051"
  data: C:\Users\ocamp\AppData\Local\Arduino15
  downloads: C:\Users\ocamp\AppData\Local\Arduino15\staging
  - C:\Users\ocamp\OneDrive\Documents\Arduino
  - C:\Users\ocamp\Documents\IoTanks\Repo_2021\libraries
  file: ""
  format: text
  level: info
  addr: :9090
  enabled: true

i already downloaded the arduino-cli and copied the executable and license under the same directory and still the same issue, i also stripped down the .yaml without all the additional urls :upside_down_face: and the problem is consistent. No matter what i put in the command line, i get the same error

Hi @iotanks76. Which version of Arduino CLI are you using?

1 Like

$ arduino-cli version
arduino-cli.exe alpha Version: 0.18.3 Commit: d710b642 Date: 2021-05-14T12:36:58Z

the problem started when I tried to install user libraries with arduino-cli install...

here my c_cpp_properties.json (i dont know if that helps, havent changed it)

    "version": 4,
    "configurations": [
            "name": "Arduino",
            "compilerPath": "C:\\Users\\ocamp\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\bin\\avr-g++",
            "compilerArgs": [
            "intelliSenseMode": "gcc-x64",
            "includePath": [
            "forcedInclude": [
            "cStandard": "c11",
            "cppStandard": "c++11",
            "defines": [

it is even weider, i erased my cli, installed an older version (0.18.1 ) in another directory
and still the same error...
my arduino IDE 1.8.15 works fine....
and I muss confess, I have another version installed (1.8.5) but in another folder and the cli is not in that version (this is my settings,json)

    "arduino.path": "C:\\Users\\ocamp\\Documents\\IoTanks\\arduino-1.8.15",
    "arduino.commandPath": "cli\\arduino-cli.exe",
    "arduino.logLevel": "info",
    "arduino.allowPDEFiletype": false,
    "arduino.enableUSBDetection": true,
    "arduino.disableTestingOpen": false,
    "arduino.skipHeaderProvider": false,
    "arduino.additionalUrls": [
    "arduino.defaultBaudRate": 115200

Aha! I see the problem now:

This is not supported. You can only have a single user directory. So pick one. For example:

  user: C:\Users\ocamp\OneDrive\Documents\Arduino

I got distracted by an unrelated issue with that "VSChina" Boards Manager URL:

So you'll also need to remove that URL from your configuration. If you really need it, there is a patched version from the PR submitted to fix their syntax error here:

thank you very much for the feedback. I removed the additional paths and I still get the error, I reinstalled the cli and removed my previous configuration and still not able to use anything else than the help. I will deinstall the cli and try some time later

Are you getting the exact same panic as before?

Or is there a different error message now?

It's possible that you had multiple unrelated problems stacked up. That presents a confusing situation where fixing one problem only gets you to the next one. That was sort of what happened to me. I immediately ran into that "invalid number literal, trying to unmarshal ""3788484 "" into Number" error when I started trying to reproduce your problem, but then couldn't understand why you were getting a completely different error from it. It took me a little while to notice that there was an additional problem with your configuration.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.