[BUG] claude ssh <config> no longer opens a remote session; the word ssh is consumed as a prompt
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?
claude ssh <config> starts an ordinary local session with ssh as the first user message, instead of connecting to the named SSH config. The config name is treated as part of the prompt.
The startDirectory description in the sshConfigs schema still points at this command:
Can be overridden by the[dir]positional argument inclaude ssh <config> [dir].
Closed issue #38495 describes claude ssh <config> connecting at v2.1.81, where the bug was that ssh also leaked in as the first prompt. Now the connection does not happen at all and only the leaked prompt remains, so this looks like a regression of the same code path rather than a feature that never shipped.
Note that claude ssh --help printing top-level help is not evidence either way: #38495 records that the command was handled by the native binary rather than registered in Commander.
What Should Happen?
claude ssh <config> opens a remote session against that SSH config, and claude ssh <config> [dir] opens it at the given directory, as the settings schema describes.
Error Messages/Logs
$ claude ssh definitely-not-a-real-config -p "x"
Could you clarify what you'd like to do with SSH? For example:
- Connect to a remote host
- Set up or troubleshoot SSH keys
- Configure `~/.ssh/config`
(exit 0, no connection attempted)
Steps to Reproduce
- Define any working SSH connection in
~/.claude/settings.jsonundersshConfigs, for example with idmy-server. - Run
claude ssh my-server -p "print exactly: WORKS". - A local session starts and answers as though the prompt were the word
ssh; no SSH connection is made. - The same happens with a config name that does not exist, so the name is never looked up.
Reproduced on 2.1.56 and on 2.1.246.
Claude Model
_No response_
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.81 (per #38495)
Claude Code Version
2.1.56 and 2.1.246 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
This is the documented workaround for startDirectory being ignored when a session starts (filed separately). With the setting not taking effect and this command not connecting, there is no supported way to open a remote session at a chosen working directory.
Searched first: #38495 covers the earlier prompt-leak on this command and is closed. I found no open report of the command failing to connect.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗