Particle CLI Error (invalid json)

I’m getting an error when flashing a locally built firmware to a Photon. It’s not an incredibly useful error, and I’m unsure of how to get more debugging data from the CLI app. Here’s the error (and, dfu-util flashing with the particle-cli is working fine)

flash device said  {"error":"invalid_request","error_description":"Error: invalid json"}

Anyone got any ideas? Or at least how to get debugging info? I don’t know much about NodeJS, or troubleshooting it. The photon is showing online, and everything else with this install seems to work ok.

I see the same problem. Here’s the whole command and errors

particle flash ntk4 system-part1-0.4.3-photon.bin
attempting to flash firmware to your device ntk4
flash device said  {"error":"invalid_request","error_description":"Error: invalid json"}
1 Like

Pinging @nexxy (at least, I think you’re the CLI dev :-)) FYI, my error presents on Win7 32-bit.

hey @mumblepins, @pvanallen,

This is definitely no good. I know we made some recent changes, so I will take a look.

thanks for the ping!

I’ve tried this myself with version 1.5.16 of the CLI and it seems to work for me. Could you verify that you’re using the latest version?


Yup, 1.5.16. Even did a fresh install on a VM. Here’s the output of reinstalling and trying with just tinker.

C:\Users\IEUser>npm uninstall -g particle-cli
unbuild particle-cli@1.5.16

C:\Users\IEUser>npm install -g particle-cli
npm WARN engine particle-cli@1.5.16: wanted: {"node":"^0.10.0"} (current: {"node
> serialport@1.7.4 install C:\Users\IEUser\AppData\Roaming\npm\node_modules\part
> node-pre-gyp install --fallback-to-build

[serialport] Success: "C:\Users\IEUser\AppData\Roaming\npm\node_modules\particle
\serialport.node" is installed via remote
C:\Users\IEUser\AppData\Roaming\npm\particle -> C:\Users\IEUser\AppData\Roaming\
particle-cli@1.5.16 C:\Users\IEUser\AppData\Roaming\npm\node_modules\particle-cl
├── cli-spinner@0.2.1
├── xtend@4.0.0
├── node-wifiscanner2@1.0.0
├── chalk@1.1.0 (escape-string-regexp@1.0.3, ansi-styles@2.1.0, supports-color@2
.0.0, strip-ansi@3.0.0, has-ansi@2.0.0)
├── when@3.7.3
├── glob@4.5.3 (inherits@2.0.1, inflight@1.0.4, once@1.3.2, minimatch@2.0.9)
├── request@2.59.0 (aws-sign2@0.5.0, forever-agent@0.6.1, caseless@0.11.0, oauth
-sign@0.8.0, tunnel-agent@0.4.1, stringstream@0.0.4, isstream@0.1.2, json-string
ify-safe@5.0.1, extend@3.0.0, node-uuid@1.4.3, combined-stream@1.0.5, qs@4.0.0,
form-data@1.0.0-rc1, mime-types@2.1.3, http-signature@0.11.0, bl@1.0.0, tough-co
okie@2.0.0, hawk@3.1.0, har-validator@1.8.0)
├── hogan.js@2.0.0
├── softap-setup@1.1.4 (nconf@0.7.1, node-rsa@0.2.24)
├── moment@2.10.3
├── inquirer@0.8.5 (figures@1.3.5, ansi-regex@1.1.1, cli-width@1.0.1, through@2.
3.8, readline2@0.1.1, lodash@3.10.0, rx@2.5.3)
└── serialport@1.7.4 (bindings@1.2.1, sf@0.1.7, async@0.9.0, debug@2.2.0, nan@1.
8.4, optimist@0.6.1)

C:\Users\IEUser>particle list
CorePrime [55ff6d065075555337361887] (Core) is offline
PinlessPhoton [2c002f000447343232363230] (Photon) is offline
PinPhoton [1b0034000447343233323032] (Photon) is online
    int digitalread(String args)
    int digitalwrite(String args)
    int analogread(String args)
    int analogwrite(String args)

C:\Users\IEUser>particle flash PinPhoton tinker
attempting to flash firmware to your device PinPhoton
flash device said  {"error":"invalid_request","error_description":"Error: invali
d json"}


Thanks for the error output! I will try to reproduce this and make a fix.

@nexxy that sounds more like a server side issue no?

@kennethlimcp, it’s possible! I haven’t been able to reproduce this issue on OS X.

1 Like

I never saw that issue before and that response {"error":"invalid_request","error_description":"Error: invalid json"} is from the :cloud: side.

Don’t see anything major change in CLI V1.5.16 that would break that.

Might want to check in with @dave


I had exactly the same issue earlier.

I had used

particle flash -usb tinker 

to try and put tinker on a device and got the strange invalid json error.

Turns out I needed to use


Might be the same for you.

You might be referring to a separate issue.

They are using OTA while you are using USB DFU transfer.

@mumblepins, @TinamousSteve any updates here? :wink: