Balena CLI with Jenkisn: server error - invalid reference format

Hello,

I am trying to integrate balena-cli in our Jenkins pipeline to automatically build and deploy on different fleets. As the deploying phase is optional, I am using build and deploy over push.

I used a Jenkins node tools with balena-cli package and it works for some projects. However for some pipelines the build fails quickly with this error message:

[Error]   Build failed.
(HTTP code 500) server error - invalid reference format 

Error: (HTTP code 500) server error - invalid reference format 
    at /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/balena-node/lib/node_modules/balena-cli/node_modules/docker-modem/lib/modem.js:315:17
    at IncomingMessage.<anonymous> (/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/balena-node/lib/node_modules/balena-cli/node_modules/docker-modem/lib/modem.js:342:9)
    at IncomingMessage.emit (node:events:529:35)
    at IncomingMessage.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1368:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

I found this post Error running CI build: server error - invalid reference format about the subject but it is not clear to me how to fix the issue.

Thanks in advance for your help.

I managed to found the error here. The problem was that my pipeline’s name in Jenkins contained a space which is not supported by the CLI.