preToolUse hook fails with ENAMETOOLONG for large files

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Issue: preToolUse hook fails with ENAMETOOLONG for large files

When editing large files, the hook receives the entire file content
in tool_input.content, causing spawn to fail before the script executes.

Suggested fix:

  1. Write hook input to a temp file and pass the path instead
  2. Or add config option to exclude tool_input.content from hook payload
  3. Or stream the data via stdin instead of passing in spawn args/env

Steps to Reproduce

When editing large files, the hook receives the entire file content
in tool_input.content, causing spawn to fail before the script executes.

Expected Behavior

no ENAMETOOLONG

Operating System

Windows 10/11

Version Information

Version: 2.4.23 (user setup)
VSCode Version: 1.105.1
Commit: 379934e04d2b3290cf7aefa14560f942e4212920
Date: 2026-01-29T21:24:23.350Z
Build Type: Stable
Release Track: Early Access
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.19045

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey @_lonelywaitingliu!

Thanks for reporting this! Can you share the exact hook you’ve configured?