Node.js spawn with cursor-agent hangs and exits with code 143 after timeout

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

When using Node.js child_process.spawn() to execute cursor-agent command, the process hangs and eventually exits with code 143 after the timeout period (60 seconds).

Steps to Reproduce

  1. Process starts but hangs indefinitely
  2. No output is received on stdout or stderr
  3. After 60 seconds (timeout), process exits with code 143
  4. Code 143 typically indicates the process was terminated by SIGTERM signal
const { spawn } = require('node:child_process');

const agent = spawn('cursor-agent', [
  '--output-format', 'text',
  '--model', 'cursor-small',
  '--api-key', 'key-xxx',
  '-p', 'Hello',
], {
  timeout: 60000,
  shell: true,
});

agent.stdout.on('data', (data) => {
  console.log('STDOUT:', data.toString());
});

agent.stderr.on('data', (data) => {
  console.error('STDERR:', data.toString());
});

agent.on('error', (error) => {
  console.error('Process error:', error);
});

agent.on('close', (code) => {
  console.log(`Process exited with code: ${code}`);
});

Expected Behavior

The cursor-agent should execute successfully and return output through stdout.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

OS: macOS (darwin 24.6.0)
Node.js: (v20.19.4)
cursor-agent: (2025.09.12-4852336)

For AI issues: which model did you use?

cursor-small

Additional Information

  • The cursor-agent command works fine when executed directly in terminal
  • The issue occurs specifically when spawning from Node.js
  • No error messages are captured in stderr

Does this stop you from using Cursor

No - Cursor works, but with this issue

2 Likes

Thanks for the report, team is looking into this.

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

Having the same issue. Looks like there was never a root cause or resolution.

Steps to Reproduce

Process starts but hangs indefinitely
No output is received on stdout or stderr
After 60 seconds (timeout), process exits with code 143
Code 143 typically indicates the process was terminated by SIGTERM signal

const { spawn } = require(‘node:child_process’);

const agent = spawn(‘cursor-agent’, [
‘–output-format’, ‘text’,
‘–model’, ‘cursor-small’,
‘–api-key’, ‘key-xxx’,
‘-p’, ‘Hello’,
], {
timeout: 60000,
shell: true,
});

agent.stdout.on(‘data’, (data) => {
console.log(‘STDOUT:’, data.toString());
});

agent.stderr.on(‘data’, (data) => {
console.error(‘STDERR:’, data.toString());
});

agent.on(‘error’, (error) => {
console.error(‘Process error:’, error);
});

agent.on(‘close’, (code) => {
console.log(Process exited with code: ${code});
});

Expected Behavior

The cursor-agent should execute successfully and return output through stdout.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

ersion: 1.7.53 (Universal)
VSCode Version: 1.99.3
Commit: ab6b80c19b51fe71d58e69d8ed3802be587b3410
Date: 2025-10-20T19:15:58.572Z (18 hrs ago)
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

For AI issues: which model did you use?

Default

Does this stop you from using Cursor

Yes - Cursor is unusable

1 Like

any way can solve now? i still have the error