Zsh Terminal State is Not Persistent in AI Assistant Due to dump_zsh_state: command not found Error

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When using the AI assistant’s terminal tool on macOS with zsh as the default shell, every command execution is followed by a zsh:1: command not found: dump_zsh_state error.
This appears to break the mechanism for terminal session persistence. As a result, each command runs in a new, isolated, and stateless session. The current working directory, environment variables, and any other shell state are reset after every command. This significantly hinders workflows that require a sequence of commands with a shared context.

Steps to Reproduce

Steps to Reproduce:
Set zsh as your default shell on macOS.
Open a project in Cursor and start a chat with the AI assistant.
Ask the assistant to run a command that changes the shell’s state. For example:
export TEST_VAR=“hello” && cd /path/to/your/project && pwd
The command will execute successfully (and show the new path), but it will be followed by the dump_zsh_state error.
Ask the assistant to run a second command to check the state:
echo “Current directory: $(pwd)” && echo “TEST_VAR: $TEST_VAR”

Expected Behavior

Expected Behavior:
The second command should execute in the directory set by the first command (/path/to/your/project).
The echo $TEST_VAR command should print “hello”.
The dump_zsh_state: command not found error should not appear.

Actual Behavior:
The second command executes in the root directory (/), not the project directory.
The echo $TEST_VAR command prints an empty line, as the variable was lost.
The zsh:1: command not found: dump_zsh_state error appears after each command.

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.6.23
VSCode Version: 1.99.3
Commit: 9b5f3f4f2368631e3455d37672ca61b6dce85430
Date: 2025-09-15T21:49:07.231Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Darwin arm64 23.1.0

For AI issues: which model did you use?

gemini-2.5-pro

Additional Information

Additional Context:
The command dump_zsh_state seems to be an internal helper script or function that Cursor’s AI agent uses to serialize the shell state between run_terminal_cmd tool calls. When this command isn’t found, the state-saving mechanism fails, leading to the stateless behavior.

Does this stop you from using Cursor

Yes - Cursor is unusable

13 Likes

I’m experiencing the same recurring issue that makes the terminal unusable. I initially thought this error was unique to my setup and was preparing to open a support ticket.

Request: Please escalate this issue.

Additional Information:

Every first terminal command triggers the following parse error:

(eval):3: parse error near `cursor_snap_ENV_VARS…’
zsh:1: command not found: dump_zsh_state

Following commands will always have

zsh:1: command not found: dump_zsh_state

5 Likes

I have the same issue.
The internal terminal does not start in the folder the project is in.
On first I get

(eval):3: parse error near `cursor_snap_ENV_VARS...'
zsh:1: command not found: dump_zsh_state

Then I get

zsh:1: command not found: dump_zsh_state
1 Like

I tried to change my shell to bash, dump_zsh_state disappeared, but

(eval):3: parse error near `cursor_snap_ENV_VARS…’ i

is still there

I tried several things, but nothing helped. Downgraded to 1.4 - everything is working there.

known issue. wait for upgrade or previous version cursor

Same issue here on: zsh 5.9 (arm-apple-darwin23.0.0)

down to v1.5 , pls fix ASAP

My investigation of the issue:

  • Previously, Cursor Chat used interactive/login shell which loads the default setup script (.bashrc in my case) with all environment variables, aliases and customizations.

  • Now, it uses non-interactive shell which just loads .profile (it still runs as the current user (OS level) as before).

  • Previously, Cursor Chat ran terminal from project root or user home dir ~.

  • Now, it runs it from file system root /.

Version: 1.6.26
VSCode Version: 1.99.3
Commit: 6af2d906e8ca91654dd7c4224a73ef17900ad730
Date: 2025-09-16T17:12:31.697Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Linux x64 6.1.0-39-amd64

3 Likes

My workaround/hack to solve on Linux

  1. Create ~/.cursor.bashrc file which is a copy of .bashrc, but without the problematic part:

REMOVE THIS FROM THE COPY:

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

(I also removed all the other parts that I don’t know what they do, system stuff I guess)

  1. Add this to your main system prompt (Cursor Settings - Rules & Memories - User Rules):
  • ALWAYS begin your terminal comands with source ~/.cursor.bashrc && to ensure proper env.
2 Likes

My issue is that I cannot input any command on the new agent terminals, so if I need to input a password or a totp for a remote ssh connection i am not able to. I do not get why they remove external terminal for agent executions. This workaround also solves that?

this version worked fine: https://downloads.cursor.com/production/2f2737de9aa376933d975ae30290447c910fdf46/darwin/arm64/Cursor-darwin-arm64.dmg

1 Like

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When the Cursor Agent tries to execute a command, it fires:
zsh:1: command not found: dump_zsh_state.
Why?

Steps to Reproduce

Setup a zsh shell globally. Ask the Agent to run a command in the terminal.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Versione: 1.6.23 (Universal)
Commit: 1.99.3
Data: 9b5f3f4f2368631e3455d37672ca61b6dce85430
Electron: 2025-09-15T21:49:07.231Z (1 giorno fa)
ElectronBuildId: 34.5.8
Chromium: undefined
Node.js: 132.0.6834.210
V8: 20.19.1
Sistema operativo: 13.2.152.41-electron.0

For AI issues: which model did you use?

mixed

In my environment (macOS Sonoma 14.7.8, Cursor 1.6.26) I had to comment out the following line from my ~/.zshrc

test -e “${HOME}/.iterm2_shell_integration.zsh” && source “${HOME}/.iterm2_shell_integration.zsh”

It fixed the issue.

2 Likes

Subject: Same issue on macOS with zsh - additional details

I’m experiencing the same issue described here:

  • Cursor AI agent stuck in root directory (/)

  • zsh:1: command not found: dump_zsh_state error after commands

  • Integrated terminal works fine and shows correct project directory

  • Issue persists across multiple projects and fresh conversations

My environment:

  • macOS (Apple Silicon)

  • Cursor v1.6.26

  • zsh shell

  • Issue started after a Homebrew installation; no recent change to cursor installation

Troubleshooting attempted:

  • Verified .zshrc has no interactive mode checks that would cause early exit

  • Tested terminal.integrated.inheritEnv settings (false/true/default)

  • No relevant changes to dotfiles except .zcompdump

  • Restarted Cursor multiple times

The AI agent and integrated terminal clearly use different shell contexts, with only the agent being affected. This suggests it’s a Cursor-specific issue rather than shell configuration.

Planning to try a clean reinstall next.

Update: reinstalled v1.5.11 and it appears to be working normally (AI agent is in the project dir persistently, and no “dump_zsh_state” errors).

Confirmed. My agent cannot run any commands any more. I’m on MacOs, Cusor Version: 1.6.26. I also see…

(eval):3: parse error near `cursor_snap_ENV_VARS…’
zsh:1: command not found: dump_zsh_state

Worst thing is that the agent even sees this as successful.

Please fix, we’re just about to run a workshop using cursor and told everyone to upgrade to 1.6!

Well, the issue seemed to have gone, but now is back again….

same issue. I fixed it by downgrading cursor to v1.5

1 Like

I’m getting the same issue.

Version: 1.6.27 (Universal)
VSCode Version: 1.99.3
Commit: d750e54bba5cffada6d7b3d18e5688ba5e944ad0
Date: 2025-09-17T20:21:17.042Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Darwin arm64 25.0.0

I was able to workaround this issue with ~/.zshenv:

# This file is sourced by all zsh shells (interactive and non-interactive)

# Initialize whatever environment stuff you need to here

Fix coming for this tomorrow. Apologies. We have been working on it

3 Likes

Hope to see it soon, have nearly the same issue. And default terminal is not zsh but bash and I see “dump_bash_state: command not found”. This virtually makes cursor not usable.