Balena local flash errors when Etcher does not

UPDATE: Running balena-cli using the last release of node.js 22 fixes the error. node v22.20.0 , balena-cli v22.4.9

I am trying to use the balena CLI to flash images locally. I am essentially trying to use this as an alternative to Etcher as this will be part of some automation workflow. The process works on Etcher (although with issues, for example I need to run it multiple times until it accepts my image file, or flash sometimes fails with “Connection to sidecar flasher process failed” – in case any of these provides helpful context). However, with Balena CLI using the commands I paste below in the log, this errors. Could you please offer me some help about this issue?

C:\Windows\System32>balena util available-drives
DEVICE SIZE DESCRIPTION
\.\PhysicalDrive1 7.8 GB Compute Module

C:\Windows\System32>balena local flash “C:\flash\image.img” --drive \.\PhysicalDrive1 --yes --debug
[debug] new argv=[C:\Program Files\balena-cli\client\bin\node.exe,C:\Program Files\balena-cli\client\bin\run,local:flash,C:\flash\image.img,–drive,\.\PhysicalDrive1,–yes] length=7
[debug] Deprecation check: 0.17684 days since last npm registry query for next major version release date.
[debug] Will not query the registry again until at least 7 days have passed.
[debug] Event tracking error: Timeout awaiting ‘response’ for 0ms
EIO: i/o error, open ‘\.\PhysicalDrive1’

DISKPART> list disk

Disk ### Status Size Free Dyn Gpt


Disk 0 Online 476 GB 1024 KB *
Disk 1 Online 7456 MB 7455 MB

I found some useful further information. An issue exactly about this was reported on balena-cli Github on 2 July 2025: Balena local flash failing · Issue #2959 · balena-io/balena-cli

Balena team investigated this “After further investigation, we found out this issue is incoming from a NodeJS bug: nodejs/node#55623”, and also said “The bug has been solved for nodejs 24 (not yet stable) and not yet backported to node 22. We will update the CLI (with a fix) once upstream nodejs 24 is stable or backported.”

I found that the mentioned bug fix (PR#55623 of node.js) is now backported to node 22.

Hi,

Thanks for reaching out, and for doing your own investigation! As you discovered the issue was due to a bug in NodeJS that had been fixed in NodeJS v24 and was just backported to v22.

We have a PR open to fix the issue for our CLI packages: Build with node 22.20.0 by otaviojacobi · Pull Request #2999 · balena-io/balena-cli · GitHub, which should be merged soon.

Thanks for shipping the new release fast!

1 Like

The PR has been merged, v22.4.10 shouldn’t have the issue anymore.