Panic: runtime error: invalid memory address or nil pointer dereference


When flashing an updated model I get the following error:

panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x2 addr=0x68 pc=0x10358f924]

I also downloaded the new eim-file to the same directory as the previous one.

Searched everywhere but can not find a solution.

Suggestions are much appreciated.

Hi @GerverA,

I need some more information to be able to assist you:

  • What is your project ID number?
  • What board are you trying to flash?
  • What IDE are you using?
  • Can you post the entire error message from your IDE (or CLI)?

Hi Shawn,

Project ID: 273272
Arduino Nano
I use a CLI
The original model worked fine. But when I updated the model I got this error
Complete CLI output:
Last login: Tue Sep 5 16:05:37 on ttys000

/Users/andregerver/Downloads/fan-demo-(anomaly-detection)-nano-33-ble-sense-v11/flash_mac.command ; exit;

The default interactive shell is now zsh.

To update your account to use zsh, please run chsh -s /bin/zsh.

For more details, please visit Use zsh as the default shell on your Mac - Apple Support.

(base) Andres-MacBook-Pro:~ andregerver$ /Users/andregerver/Downloads/fan-demo-(anomaly-detection)-nano-33-ble-sense-v11/flash_mac.command ; exit;

You’re using an untested version of Arduino CLI, this might cause issues (found: 0.34.0, expected: 0.18.x)

Finding Arduino Mbed core…

Finding Arduino Mbed OK

Finding Arduino Nano 33 BLE…

Finding Arduino Nano 33 BLE OK

Flashing board…

panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x2 addr=0x68 pc=0x105327924]

goroutine 1 [running]:*Sketch).GetDefaultFQBN(...), {0x1400013cf60, 0x0, 0x10532ca58?}) +0x1d4*Command).execute(0x140003aa500, {0x1400013cf00, 0x6, 0x6}) +0x53c*Command).ExecuteC(0x140002d6780) +0x318*Command).Execute(0x0?) +0x1c

main.main() +0x110


Saving session…

…copying shared history…

…saving history…truncating history files…


Deleting expired sessions…none found.

[Process completed]

Thanks for you help in advance

Hi @GerverA,

Are you using the Arduino Nano 33 BLE Sense Rev1 or Rev2?

Also, what do you mean by “updated the model?” How did you go about updating the model?

Hi @shawn_edgeimpulse Shawn,

I use a Rev1.

I first trained a model and flashed it to the board. And it worked fine.

Then I added two features, labeled them, trainde and tested. Went trough all the steps in the studio. Then I build the model in deployment tab.

Can you work with this or do you eed more info?

Hi @GerverA,

Thank you for supplying this information. I can replicate the error on my computer, and it does seem to be a bug. I have filed an issue with our engineering team. In the meantime, could you try deploying as an Arduino library instead of a pre-compiled firmware?

Thanks @shawn_edgeimpulse,

When and how will I be notified of the outcome of the engineering team.

Hi @GerverA,

After chatting with engineering, I learned that this is an arduino-cli issue and not something from Edge Impulse. The error shows up when using arduino-cli v0.34. The workaround is to use arduino-cli v0.33.1. To do that, download arduino-cli v0.33.1 for your system.

From there, copy your 2 .bin files from the deploy ZIP to your arduino-cli folder. So, you should have something like this if you run ls:

shawnhymel@Shawn-Hymel-LQNW70Y61L arduino-cli_0.33.1_macOS_ARM64 % ls

Connect your Nano 33 BLE to your computer and run the ./arduino-cli board list command to see which port your board is connected to:

shawnhymel@Shawn-Hymel-LQNW70Y61L arduino-cli_0.33.1_macOS_ARM64 % ./arduino-cli board list
Port                            Protocol Type              Board Name          FQBN                        Core             
/dev/cu.Bluetooth-Incoming-Port serial   Serial Port       Unknown                                                          
/dev/cu.BoseQC35II              serial   Serial Port       Unknown                                                          
/dev/cu.usbmodem1201            serial   Serial Port (USB) Arduino Nano 33 BLE arduino:mbed_nano:nano33ble arduino:mbed_nano

Use that port to upload the .bin files to the Arduino with:

./arduino-cli upload -p /dev/cu.usbmodem1201 --fqbn arduino:mbed_nano:nano33ble --input-dir .

This should successfully flash the board. For example, this is what I see:

shawnhymel@Shawn-Hymel-LQNW70Y61L arduino-cli_0.33.1_macOS_ARM64 % ./arduino-cli upload -p /dev/cu.usbmodem1201 --fqbn arduino:mbed_nano:nano33ble --input-dir .
Device       : nRF52840-QIAA
Version      : Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Address      : 0x0
Pages        : 256
Page Size    : 4096 bytes
Total Size   : 1024KB
Planes       : 1
Lock Regions : 0
Locked       : none
Security     : false
Erase flash

Done in 0.001 seconds
Write 262200 bytes to flash (65 pages)
[==============================] 100% (65/65 pages)
Done in 10.432 seconds
1 Like

Hi @GerverA,

Could you share with us the Apple hardware you’re using and OS version? This will be helpful for the Arduino to identify / replicate the issue you’re seeing with version 0.34 of the Arduino cli tools.



Arduino is handling the issue which seems to only occur on MacOS. Here’s the link for tracking: Runtime error using `arduino-cli upload` with version 0.34 · Issue #2304 · arduino/arduino-cli · GitHub


Hi @Arjan,

I use OS version 13.5.1.



Thanks @GerverA,

Arduino just released a new version (0.34.2) which should resolve the issue.