[BUG] /keybindings deadlocks the terminal when $EDITOR is unset (no graceful fallback)

Open 💬 0 comments Opened Jun 20, 2026 by FelixCenusa

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Running /keybindings creates ~/.claude/keybindings.json successfully, then
tries to open it in an external editor. With $EDITOR and $VISUAL unset, the
editor launch deadlocks the terminal: the tab becomes completely
unresponsive to keyboard input and cannot be recovered from any terminal
frontend (tried both iTerm2 and cmux). There is no error message and no
fallback
— it just freezes.

The same deadlock affects the in-app "open in external editor" action
(chat:externalEditor, bound to Ctrl+G / Ctrl+X Ctrl+E).

The Claude session itself survives (it can be resumed via claude agents), but
the terminal tab is dead and must be force-closed.

What Should Happen?

With no $EDITOR configured, the command should fail gracefully — e.g. print a
message like:

No $EDITOR set; edit ~/.claude/keybindings.json directly (changes auto-apply).

…instead of deadlocking the terminal. At minimum it should never leave the
terminal in an unrecoverable state.

Error Messages/Logs

None. The terminal deadlocks silently, no error message is printed. (The
absence of any error is itself part of the problem.)

Steps to Reproduce

  1. Ensure $EDITOR and $VISUAL are both unset (the default on macOS):

echo "$EDITOR / $VISUAL" → both empty.

  1. Run /keybindings.
  2. ~/.claude/keybindings.json is created.
  3. Claude attempts to open the file in an external editor.
  4. The terminal tab freezes and accepts no further keyboard input. It cannot be

recovered and must be force-closed.

Note: my session was running inside cmux (however Terminal & iTerm2 had the same issue) and launched via a wrapper as a background/resumable session, which may aggravate the deadlock (TTY handover in a backgrounded session). Unclear whether this reproduces for ALL users with
$EDITOR unset, or only in nested/backgrounded sessions.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.185 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

Issue persisted inside Terminal.app, iTerm2 and CMUX.

<!-- Uploading "Screenshot 2026-06-21 at 01.24.32.png"... —>

<!-- Uploading "Screenshot 2026-06-21 at 01.25.52.png"... —>

Keybindings / external-editor freeze — workaround

Option 1 (recommended): set an editor so the launch works.
Add these two lines to ~/.zshrc:

export EDITOR='code --wait'
export VISUAL='code --wait'

Then open a new terminal, or run: source ~/.zshrc

Option 2: skip the command entirely.
Edit the file directly — it auto-reloads, no restart needed:

code ~/.claude/keybindings.json

If a terminal tab is already frozen:

  • Try pressing q then Enter, or Ctrl+C, or Ctrl+X
  • From another terminal: pkill -f 'vi |vim |nano' (check ps first)
  • Worst case: close the tab. The session is resumable with: claude agents

View original on GitHub ↗