Atlassian Companion app fails to edit Office file due to 'SyntaxError: Unexpected token '<'' error

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Confluence Server and Data Center users are unable to edit attached files using the Install Atlassian Companion app.

When they click Edit with in the preview, or Edit on the attachments page, or macro, they are prompted to download the Companion app, even though the Companion app is running.

(Auto-migrated image: description temporarily unavailable)

Diagnosis

When reviewing the companion.log files, it can be observed that the Atlassian Companion app managed to launch successfully in a local WebSocket server:

1 2 3 4 5 info: adc:initialiseApp 2023-10-16T11:24:27.972Z App is ready info: adc:file-manager 2023-10-16T11:24:28.293Z clearing file manager cache info: adc:browser 2023-10-16T11:24:28.295Z launching websocket info: adc:fileWindowController 2023-10-16T11:24:28.295Z init file window info: adc:browser 2023-10-16T11:24:28.664Z direct websocket launched successfully on port: 31459

After these messages, the following error message can be observed: 

1 2 3 4 5 6 7 8 9 10 11 error: adc:ServerFacade 2023-10-16T11:24:44.496Z Could not get temp link information: error: adc:ServerFacade 2023-10-16T11:24:44.497Z SyntaxError: Unexpected token '<', " <!-- Copyr"... is not valid JSON at JSON.parse (<anonymous>) at u.json (C:\Users\USERNAME\AppData\Local\atlassian-desktop-companion\app-1.6.0\resources\app.asar\.webpack\main\index.js:2:27108) at _.awaitJson (C:\Users\USERNAME\AppData\Local\atlassian-desktop-companion\app-1.6.0\resources\app.asar\.webpack\main\index.js:2:23982) at process.processTicksAndRejections (node:internal/process/task_queues:96:5) at async t.default.getTempLinkMetadata (C:\Users\USERNAME\AppData\Local\atlassian-desktop-companion\app-1.6.0\resources\app.asar\.webpack\main\index.js:8:1196028) at async g.retrieveTempLinkData (C:\Users\USERNAME\AppData\Local\atlassian-desktop-companion\app-1.6.0\resources\app.asar\.webpack\main\index.js:8:1194953) at async g.handleProtocol (C:\Users\USERNAME\AppData\Local\atlassian-desktop-companion\app-1.6.0\resources\app.asar\.webpack\main\index.js:8:1192171)

Cause

The error SyntaxError: Unexpected token < in JSON  in the above stack trace indicates that there is some issue while authenticating the user's account as the Companion app expects the response to be a JWT token. However, it seems a different format is returned, such as a HTML page (the Confluence login page).

This issue may be caused by a proxy/load balancer or a SSO configuration. 

Solution

Review your Proxy/Load Balancer configuration.

If your users are accessing Confluence via a transparent SSO, such as Kerberos via F5, it's possible that the Companion can't authenticate with the JWT token alone to access Confluence. 

Some customers have also reported that this might be related to their VPN configuration, as suggested in the following post of our Atlassian Community: 

Updated on March 19, 2025

Still need help?

The Atlassian Community is here for you.