Unable to use balena cli after updating


I have tried to upgrade the balena-cli package to the latest update, but after the installation and the login I get this error trying to do the command:

balena devices

BalenaRequestError: Request error: <!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<pre>Cannot GET /v6/device</pre>

at Object.<anonymous> (/usr/local/lib/balena-cli/node_modules/balena-request/build/request.js:190:27)
at Generator.next (<anonymous>)
at fulfilled (/usr/local/lib/balena-cli/node_modules/tslib/tslib.js:111:62)
at process._tickCallback (internal/process/next_tick.js:68:7)

Am I forgetting something before being able to exploit balena-cli?



Just checking, are you running this against openBalena or balenaCloud? The latest API uses a version (v6) of the API models which the current openBalena API doesn’t have.

I am a openBalena user, so I should downgrade the balena cli?

Yes. The last version of the CLI before using the v6 endpoint was 12.14.0 so try that, and if that reports an issue then we can go back further.

Hi, I have downgraded it to this version:

balena --version

But still having some troubles while preloading an image.

balena preload balena-cloud-raspberrypi3-2.51.1+rev1-dev-v11.4.10.img

Building Docker preloader image. [========================] 100%

| Checking that the image is a writable file

| Finding a free tcp port and getting balena settings

| Checking if the image is an edison zip archive

/ Creating preloader container

/ Starting preloader container

| Reading image information

? **Select an application** r3-generic

? **Select a release** current

\ Fetching application 47

/ Cleaning up temporary files

BalenaRequestError: Request error: <!DOCTYPE html>

<html lang="en">


<meta charset="utf-8">




<pre>Cannot GET /v6/application(47)</pre>



** EDIT**

at /usr/local/lib/balena-cli/node_modules/balena-request/build/request.js:189:17
From previous event:
    at /usr/local/lib/balena-cli/node_modules/balena-request/build/request.js:181:62
From previous event:
    at Object.exports.send (/usr/local/lib/balena-cli/node_modules/balena-request/build/request.js:180:8)
    at /usr/local/lib/balena-cli/node_modules/balena-pine/es2018/index.js:20:22
From previous event:
    at BalenaPine._request (/usr/local/lib/balena-cli/node_modules/balena-pine/es2018/index.js:12:34)
    at BalenaPine.request (/usr/local/lib/balena-cli/node_modules/pinejs-client-core/es2018/index.js:952:29)
    at BalenaPine.get (/usr/local/lib/balena-cli/node_modules/pinejs-client-core/es2018/index.js:701:21)
    at /usr/local/lib/balena-cli/node_modules/balena-preload/node_modules/balena-sdk/es2018/models/application.js:245:26
From previous event:
    at Object.get (/usr/local/lib/balena-cli/node_modules/balena-preload/node_modules/balena-sdk/es2018/models/application.js:239:32)
    at Object.get (/usr/local/lib/balena-cli/node_modules/balena-preload/node_modules/balena-sdk/es2018/util/callbacks.js:19:27)
    at Promise.try.then (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:498:47)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
    at process.topLevelDomainCallback (domain.js:126:23)
From previous event:
    at _runWithSpinner (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:497:8)
    at Preloader._runWithSpinner (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:305:12)
    at Preloader._fetchApplication (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:481:17)
    at Preloader.setAppIdAndCommit (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:781:17)
    at prepareAndPreload (/usr/local/lib/balena-cli/build/actions/preload.js:196:21)


even if I am able to get the result of balena apps

Any suggestion?

Hi @matteopeluso, can you retry downgrading to an older version than 12.11.3?


I am not having these error anymore with the version:


Great, glad it works for you!

Good to know newer versions are working! Still running on v12.2.2. You @balena should update the getting starting guide at

@linus_h, unfortunately I believe the advice remains to downgrade the CLI to v12.2.2, as documented in openBalena’s Getting Started guide, as you have pointed out. CLI v12.2.2 offers full compatibility with openBalena (across all CLI commands), while newer versions will offer partial compatibility - some CLI commands will work, others won’t. The underlying reason is that openBalena is pending an update to work with balena SDK v14 or newer, which builds on balena API’s “/v6” HTTP endpoint.

@matteopeluso’s finding specifically regarding the balena preload command makes sense (that it works with CLI v12.9.4 but not with CLI v12.11.3), because CLI v12.9.5 updated the balena-preload dependency to a newer version that relies on balena SDK v14, which is currently incompatible with openBalena.

Relevant GitHub issues for tracking / subscribe for updates: