"Retry as Sudo" fails with Node.util.isObject is not a function (Cursor 3.20.21 / Electron 42 / Node 24)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Retry as Sudo" fails with Node.util.isObject is not a function (Cursor 3.20.21 / Electron 42 / Node 24)

Steps to Reproduce

  1. Open a root-owned file, e.g. /etc/hosts, in the editor.
  2. Make a change and save (Cmd+S).
  3. Dialog appears: Failed to save 'hosts': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser.
  4. Click Retry as Sudo…

Operating System

MacOS

Version Information

Title: “Retry as Sudo” fails with Node.util.isObject is not a function (Cursor 3.20.21 / Electron 42 / Node 24)

Cursor version: 3.20.21
Electron: 42.10.0 Bundled Node: 24.18.1
OS: macOS 26.6.2 (25G83), Apple Silicon (arm64)

Steps to reproduce

  1. Open a root-owned file, e.g. /etc/hosts, in the editor.
  2. Make a change and save (Cmd+S).
  3. Dialog appears: Failed to save 'hosts': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser.
  4. Click Retry as Sudo…

Expected: macOS admin/Touch ID prompt appears and the file is saved.
Actual: Save fails immediately with
Failed to save 'hosts': Node.util.isObject is not a function
No auth prompt is ever shown; the file is never written.

Root cause (already located)
/Applications/Cursor.app/Contents/Resources/app/node_modules/@vscode/sudo-prompt/index.js
(version 9.3.1) calls the legacy util.is* helpers:

var Node = { ..., util: require('util') };

function Exec() {
  ...
  if (Node.util.isObject(arguments[1])) {        // line 35
    ...
  } else if (Node.util.isFunction(arguments[1])) { // line 37

Those APIs were removed in modern Node. Verified in your own runtime:

$ ELECTRON_RUN_AS_NODE=1 /Applications/Cursor.app/Contents/MacOS/Cursor \
    -e "const u=require('util');console.log(process.versions.node, typeof u.isObject, typeof u.isFunction)"
24.18.1 undefined undefined

So Exec() throws before any osascript prompt can be shown.

Suggested fix: bump @vscode/sudo-prompt to a maintained version, or replace
Node.util.isObject(x) → typeof x === 'object' && x !== null and
Node.util.isFunction(x) → typeof x === 'function' (same for the other 2 call sites).

Impact: the built-in elevated save (Retry as Sudo / Overwrite as Sudo) is unusable
for every root-owned file on this build, not specific to /etc/hosts.

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey @Judon

This isn’t anything on your end. In the meantime you can edit root-owned files straight from a terminal: sudo nano /etc/hosts (or sudo vi). If you’d rather keep editing in Cursor, use File > Save As… to a path you own, back up the original with sudo cp /etc/hosts /etc/hosts.bak, then sudo cp your-edit /etc/hosts.

We’ve let the team know and I’ll post back here once there’s an update.