"forge build" command starting to fail with "invalid json response..." error

This morning, when trying to execute: “forge build” I get errors like below. Any idea what is going on? Yesterday all was ok.

If I try to open the URL mentioned in the error I get a 404 error.

Thanks.

root@LP-AST03526:/opt/RD/JiraCustomFieldPlugin/forge# forge build --verbose
Building and uploading your app.
Press Ctrl+C to cancel.

Running forge lint...

Error: invalid json response body at https://developer.atlassian.com/cloud/jira/service-desk/swagger.v3.json reason: Unexpected end of JSON input

Error: invalid json response body at https://developer.atlassian.com/cloud/jira/service-desk/swagger.v3.json reason: Unexpected end of JSON input
    at lint (/root/.nvm/versions/node/v24.15.0/lib/node_modules/@forge/cli/node_modules/@forge/lint/out/lint/lint.js:131:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async LintService.run (/root/.nvm/versions/node/v24.15.0/lib/node_modules/@forge/cli/out/service/lint-service.js:30:29)
    at async BuildController.verifyPreBuild (/root/.nvm/versions/node/v24.15.0/lib/node_modules/@forge/cli/out/command-line/controller/build-controller.js:71:33)
    at async BuildController.run (/root/.nvm/versions/node/v24.15.0/lib/node_modules/@forge/cli/out/command-line/controller/build-controller.js:49:13)
    at async /root/.nvm/versions/node/v24.15.0/lib/node_modules/@forge/cli/out/command-line/register-build-commands.js:48:16
    at async Command.actionProcessor (/root/.nvm/versions/node/v24.15.0/lib/node_modules/@forge/cli/out/command-line/command.js:283:28)
    at async Command.parseAsync (/root/.nvm/versions/node/v24.15.0/lib/node_modules/@forge/cli/node_modules/commander/lib/command.js:1104:5)
    at async Command.parse (/root/.nvm/versions/node/v24.15.0/lib/node_modules/@forge/cli/out/command-line/command.js:165:13)
    at async main (/root/.nvm/versions/node/v24.15.0/lib/node_modules/@forge/cli/out/command-line/index.js:94:5)
root@LP-AST03526:/opt/RD/JiraCustomFieldPlugin/forge#

I have the same issue. It was working previously. Interestingly it works for one of my colleagues and doesn’t work for another one.

I have the same issue.

It’s working properly now.

The forge lint command downloads the swagger files for Atlassian REST endpoints so that it can check for missing scope declarations in your manifest. It looks like, for some reason, the CLI is not receiving a valid JSON file when attempting to do this.

As a workaround, you can use the --no-verify flag when running forge build, which would bypass the linting checks.

there is again now the same error while trying to run forge deploy… Will this be fixed by Atlassian?

thanks

I’m having the same issue, whenever I ran forge lint I keep getting this message

Error: Invalid response body while trying to fetch https://developer.atlassian.com/cloud/confluence/openapi-v2.v3.json: Premature close

or this if I use forge deploy --no-verify

Error: Invalid response body while trying to fetch https://api.atlassian.com/graphql: Premature close

Same here we are facing issue

forge deploy -e staging
12s
+ forge deploy -e staging
Deploying your app to the staging environment.
Press Ctrl+C to cancel.
Running forge lint...
Error: Invalid response body while trying to fetch https://developer.atlassian.com/cloud/confluence/swagger.v3.json: Premature close

Same here

This issue is also happening for us too.

Both `forge lint` and `forge deploy --no-verify` are failing because of this Invalid response body error.

It is important to note that we run those commands in Bitbucket pipelines.

We also tried the suggested workaround by addding --no-verify :

forge deploy -e staging --no-verify

Unfortunately, forge deploy still fails with the same error while fetching the Swagger JSON, so --no-verify doesn’t help in our case. As a result, we are currently blocked from deploying our Forge app, which is blocking our QA testing.

Hi everyone, I just messaged the support team and they redirected me to a ticket with a workaround suggestion

If the workaround in the ticket still doesn’t work, please do raise an ECOHELP ticket.

The issue seems to be with an external dependency.

node:22 was pulling the latest Node.js v22.23.0, which has a known bug causing Forge commands to fail with Premature close. as per above ECO ticket.

After pinning the pipeline to node:22.22.0, the issue was fixed.

thanks

This solution worked for me. Not only that, I used `nvm` to install `v.22.23.0` in my local environment and after running `forge lint` and `forge deploy` with that version I was able to consistently reproduce the bug described above.

Atlassian could you please fix this? Thanks

Hi there, thanks for reporting this.

As mentioned by @Archer above, this is an issue with Nodejs unfortunately, and not the Forge CLI itself.

There is a bug opened against Node here to fix the issue - http: node-fetch throws ERR_STREAM_PREMATURE_CLOSE on keep-alive socket closures after latest security releases · Issue #63989 · nodejs/node · GitHub

One solution is to pin back to a previous version of Node which does not include the regression, ie: v24.16 or v22.22

We also have a ticket in our backlog to migrate the Forge CLI from node-fetch to the native fetch (undici), which would also fix some deprecation messages - FRGE-1750

Hope this helps.