Sandbox commands fail with "_encode:25: command not found: -e"

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Title: Sandbox commands fail with “_encode:25: command not found: -e”

Description:
When AI agent runs terminal commands via run_terminal_cmd with sandbox enabled,
all commands fail with “_encode:25: command not found: -e” error.

Environment:

  • OS: macOS 25.0.0 (Darwin Kernel Version 25.0.0)
  • Shell: /bin/zsh
  • Cursor Version: [your version]
  • Sandbox: Enabled
  • Permissions requested: network, all (both fail)

Steps to Reproduce:

  1. Enable sandbox mode
  2. Have AI agent run any terminal command with network permissions
  3. Error appears 8 times: “_encode:25: command not found: -e”

Expected: Command executes
Actual: Command fails with encoding error

Workaround: Running commands manually in terminal works fine

Version: 2.0.64 (Universal)
VSCode Version: 1.99.3
Commit: 25412918da7e74b2686b25d62da1f01cfcd27680
Date: 2025-11-06T04:35:14.424Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.0.0

Steps to Reproduce

  1. Enable Sandbox Mode

    • Go to Cursor Settings (Cmd+,)
    • Search for “sandbox”
    • Set “Auto-Run in Sandbox” to ON
    • Set “Auto-Run Network Access” to “Ask Every Time”
  2. Create a test file in workspace

    In terminal, create a simple project

    mkdir ~/cursor-sandbox-test
    cd ~/cursor-sandbox-test
    echo “test” > test.txt
    3. Open the folder in Cursor

    • File → Open Folder → Select ~/cursor-sandbox-test
  3. Ask AI agent to run a command requiring network

    • In chat, ask: “Run this command: curl -I https://google.com
    • Or ask: “Build a container with podman”
  4. Observe the error

    • Agent will attempt to execute via run_terminal_cmd tool
    • With required_permissions: ["network"]
    • Error appears 8 times:

Expected Behavior

no terminal commands work

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.64 (Universal)
VSCode Version: 1.99.3
Commit: 25412918da7e74b2686b25d62da1f01cfcd27680
Date: 2025-11-06T04:35:14.424Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.0.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. Try this:

  1. Open Settings Cmd+Shift+J → Agents → Inline Editing & Terminal
  2. Enable “Legacy Terminal Tool”
  3. Cmd+Shift+P → “Terminal: Kill All Terminals”
  4. Restart Cursor

This should fix the sandbox issue.

Also check ~/.zshrc or ~/.zshenv — if there’s something like exec bash or other shell-switching commands, that can cause the problem.

If it still doesn’t work, please share errors from Help → Toggle Developer Tools → Console.

I have the same problem
and still not work after enable Legacy Terminal Tool

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.