Skip to content

TypeError: Converting circular structure to JSON when downloading Coder binary #606

@davo-canva

Description

@davo-canva

We're seeing this exception when the extension tries to download a new version of the Coder CLI in Cursor.

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'TLSSocket'
    |     property 'parser' -> object with constructor 'HTTPParser'

It seems like this only affects older versions of VSCode, as I can't reproduce this in VSCode 1.104.2. The bug was introduced in extension version 1.11.0. The download works when downgrading the extension to version 1.10.1.

The output logs preceding this:

2025-10-02 14:14:18.402 [info] Downloading since existing binary does not match the server version
2025-10-02 14:14:18.403 [info] Removed coder-darwin-arm64.temp-bs1fi
2025-10-02 14:14:18.403 [info] Downloading binary from /bin/coder-darwin-arm64
2025-10-02 14:14:18.437 [info] Using ETag 93ba9ec75313948cc85baadc9914917c70e4350e
2025-10-02 14:14:18.862 [warning] Converting circular structure to JSON
    --> starting at object with constructor 'TLSSocket'
    |     property 'parser' -> object with constructor 'HTTPParser'
    --- property 'socket' closes the circle

The call stack looks like this, when I run in debug mode:

Full stack trace
formatContentLength (/Users/davidv/work/vscode-coder/src/logging/formatters.ts:40)
logResponse (/Users/davidv/work/vscode-coder/src/logging/httpLogger.ts:68)
<anonymous> (/Users/davidv/work/vscode-coder/src/api/coderApi.ts:232)
process.processTicksAndRejections (internal/process/task_queues:95)
Promise.then (Unknown Source:0)
_request (/Users/davidv/work/vscode-coder/node_modules/axios/dist/node/axios.cjs:4599)
request (/Users/davidv/work/vscode-coder/node_modules/axios/dist/node/axios.cjs:4478)
Axios.<computed> (/Users/davidv/work/vscode-coder/node_modules/axios/dist/node/axios.cjs:4647)
wrap (/Users/davidv/work/vscode-coder/node_modules/axios/dist/node/axios.cjs:31)
download (/Users/davidv/work/vscode-coder/src/core/cliManager.ts:253)
fetchBinary (/Users/davidv/work/vscode-coder/src/core/cliManager.ts:133)
await (Unknown Source:0)
processTicksAndRejections (internal/process/task_queues:95)
await (Unknown Source:0)
processTicksAndRejections (internal/process/task_queues:95)
await (Unknown Source:0)
processTicksAndRejections (internal/process/task_queues:95)
await (Unknown Source:0)
setup (/Users/davidv/work/vscode-coder/src/remote/remote.ts:301)
await (Unknown Source:0)

const estimated = Buffer.byteLength(JSON.stringify(data), "utf8");

const len = formatContentLength(response.headers, response.data);

logResponse(logger, response, getLogLevel(configProvider()));

const resp = await client.get(source, {

const status = await this.download(client, binSource, writeStream, {

IDE version information

Cursor Version: 1.7.28 (Universal)
VSCode Version: 1.99.3
Commit: adb0f9e3e4f184bba7f3fa6dbfd72ad0ebb8cfd0
Date: 2025-10-01T02:45:21.769Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.6.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions