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
- Open a root-owned file, e.g.
/etc/hosts, in the editor. - Make a change and save (Cmd+S).
- Dialog appears:
Failed to save 'hosts': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser. - 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
- Open a root-owned file, e.g.
/etc/hosts, in the editor. - Make a change and save (Cmd+S).
- Dialog appears:
Failed to save 'hosts': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser. - 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