[BUG] Enter key non-functional when $USER is set

Resolved 💬 16 comments Opened Mar 11, 2025 by f1sherman Closed Mar 28, 2025
💡 Likely answer: A maintainer (wolffiex, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.36
  • Operating System: MacOS 15.3.1
  • Terminal: iTerm2, Terminal app

Bug Description

For some reason, the Enter key is totally non-functional for me in Claude Code. It works everywhere else in my system, but not in Claude Code. Hitting Enter does nothing at all. I've tried both iTerm2 and Terminal. Interestingly, Option+Enter still works for creating a newline, but Enter does nothing. It has to be something to do with the configuration of this laptop, because another MacOS laptop with an almost identical setup works just fine. Any ideas how to troubleshoot? Claude has not been able to help me resolve the issue.

Steps to Reproduce

  1. Open Claude
  2. Type a command
  3. Hit Enter --> nothing happens

Expected Behavior

Command is executed

Actual Behavior

Command is not executed

View original on GitHub ↗

16 Comments

f1sherman · 1 year ago

Ok, I narrowed down the problem. It only happens with the env var USER=brianjohn is present. If I remove that env var, the Enter key works fine. Very strange!

fogboots · 1 year ago

+1 Removing USER={name} from MacOS environment variables fixed it.

cscereske · 1 year ago

Ran into the same issue. Removing the USER variable from my environment solved it.

adamsteen · 1 year ago

+1

Ran into the same issue. Removing the USER variable from my environment solved it.

LogicWolfe · 1 year ago

I'm also encountering this issue. It first appeared after deleting an API key. Deleting the USER variable fixes it but it breaks again in a new shell once the USER variable comes back.

boriseto · 1 year ago

Same behaviour like others, deleted an API key before logging out and now it won't allow to logout through the commands either. Using a Linux distro instead Mac though.

wolffiex collaborator · 1 year ago

wow, what a strange bug! I will investigate

wolffiex collaborator · 1 year ago

I looked at this a little bit. The most likely culprit is that we rely on $USER to figure out where to store/retrieve your API key. Messing with this may cause problems, though I can't repro the issue with the enter key. Instead if I do like USER=foo claude I get Invalid API key · Please run /login

LogicWolfe · 1 year ago

@wolffiex I attempted to reproduce on another system and was unable to. I did try clearing out the Claude json file in my home directory when I first encountered the problem. This triggered a login flow without /login (which didn't work because of the enter key problem). I was able to reauth but then as soon as I got through the auth flow I was back to being unable to press enter.

wolffiex collaborator · 1 year ago

Ok, we found a bug in our permissions related to the $USER env var. Mind re-testing with v0.2.55+

f1sherman · 1 year ago

It's working great for me now, thanks!

jeffphp · 1 year ago

If you meet this error, temporarily run this command before running claude :

export ANTHROPIC_API_KEY=

sprintweb · 1 year ago

Still the same for me - Enter not working.
But removing variables doesn't help.

Terminal - any.
System - ubuntu 24.04.
Claude -v = 1.0.33.

I just press enter and it doesn't apply - only white spaces appears below.

!Image

Only
claude "command"
works.
Until I need to press Enter :(

wolffiex collaborator · 1 year ago

is the terminal hung when you are in this state? do the number keys work?

sprintweb · 1 year ago
is the terminal hung when you are in this state? do the number keys work?

no, its working, but claude donesn't

github-actions[bot] · 11 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.