Issue: Agents not getting found on Remote
Hey,
wanted to try the app and encountered an issue while initializing.
I've added my Remote Host as per-documentation from https://docs.runmaestro.ai/ssh-remote-execution. Test Connection says "Conntected as xxx" - test passed.
When i select the remote connection when configuring a new agent (either Wizard or manually), claude code doesnt get recognized. claude is added to PATH and can be run on the remote machine through claude. So it should be recognized there.
What i did capture on the manual "Create New Agent" window:
When changing from Local Execution to the Remote Host and refreshing detection, i'm getting this debug info:
where claude failed (exit code 1): INFORMATION: Es konnten keine Dateien mit dem angegebenen Muster gefunden werden.
Platform: win32
Home:
PATH:
C
\WINDOWS\system32;C
\WINDOWS;C
\WINDOWS\System32\Wbem;C
\WINDOWS\System32\WindowsPowerShell\v1.0\;C
\WINDOWS\System32\OpenSSH\;C
\Program Files\Git\cmd;C
I think the app is still scanning locally while the app should scan the remote host for claude.
Thanks for this report, I've been battling this issue for a bit. Not sure why it doesn't work for some folks but does for others. Will be digging deeper into it today.
Thanks for the detailed root cause hypothesis – it was spot on! We've addressed this race condition in commit 975f23e4.
The fix: When SSH detection is slow or pending, we now create a fallback agent config from the tile data so configuringAgent is never undefined when you click the gear button. We also added a "Detecting agent on remote host..." banner to indicate detection is still in progress.
This will be included in v0.14.5.
We weren't able to reproduce this issue on our end, so we're flying a bit blind here. Would really appreciate it if you could give 0.14.5 a try once it's out and let us know if it resolves the problem. Thanks!
Glad you found a cause - i'll try it out!
I've built the binaries for your commit and couldn't get the remote claude instance working at first. Same behaviour as before.
BUT i made it working (somehow.. lol):
I went into Settings -> SSH Remote and double-checked my settings. Everything looked fine from hostname to private key file. For the sake of trying i've put in the remote working directory, which i couldn't enter in the manual window (it says: "Path not found or not accessible" in the manual window), started the Wizard back up and it detected Claude!
I've hooked up a new SSH-Connection to try out discoverage by hand:
root@ubuntu:~# whereis claude
claude: /usr/local/bin/claude /root/.local/bin/claude
root@ubuntu:~# which claude
/root/.local/bin/claude
root@ubuntu:~# echo $PATH
:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
and the ultimate, but simple:
root@ubuntu:~# claude
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Ready to code here?
/root
I'll need permission to work with your files.
This means I can:
- Read any file in this folder
- Create, edit, or delete files
- Run commands (like npm, git, tests, ls, rm)
- Use tools defined in .mcp.json
Learn more
❯ 1. Yes, continue
2. No, exit
Enter to confirm · Esc to cancel
So every command to find a claude instance is working, atleast from the ssh client.
From Maestro it only works when i enter the optional working directory. Does the SSH Client need to open a folder at establishment of the ssh connection?
I've tried to actually run und whereis claude in / but that also works. Hope that's a tiny bit of help.
Yes that does help thank you. I'm looking into why that's required. In fact I was thinking of even removing it.
Root Cause Found 🎯
After deep analysis, I believe I've identified the real issue. It's not about the working directory per se - it's about how Linux shells initialize.
The Problem
When we SSH and run commands, we use:
$SHELL -lc "which claude"
The -l flag makes it a login shell (sources ~/.profile), but -c makes it non-interactive.
On Ubuntu, ~/.profile sources ~/.bashrc, BUT ~/.bashrc has a guard at the top:
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
Since -c is non-interactive, $- doesn't contain i, so .bashrc exits early and any PATH additions (like ~/.local/bin where your Claude lives) never get applied!
The Fix
Changed from -lc to -ilc:
$SHELL -ilc "which claude"
The -i flag forces interactive mode, allowing .bashrc to run fully and load your complete PATH.
Commit: Will be in the next push.
Why Working Directory Seemed to Help
Honestly, it shouldn't have made a difference for PATH. The cd command doesn't affect shell initialization. You might have been experiencing two separate issues:
- The race condition we fixed earlier (UI crash when clicking gear during detection)
- This shell initialization issue (agent not found)
Or possibly you have direnv or similar that loads environment when entering certain directories?
Let us know if this fix resolves it for you!
@chr1syy will you try latest main? made a change to the default flags used for ssh and removed that remote directory entirely, it's adding confusion. let's see if this works for you please. huge help that you can run it without my having to cut a release!
Yes i've built and tested your newest commits (8824707).
The remote instance of claude doesn't get recognized at all now.
Settings:
SSH-Connection is being loaded from .ssh, test connection says its "successful". One thing i did capture: When testing connection through the test conection symbol on the remote host list, it says; "connected to xxx", where xxx is my own Hostname, not the remote host.
Wizard:
"Detecting available agents..." is running for approx 10 seconds and doesn't discover any agents. I can't customize it to try the PATH i know of.
Manual:
Basically some thing as before, claude is not discovered, if i try a working directory it says "Path not found or accessible". If i enter the PATH for claude, i can't go on further or test availability of the agent (only a clear button next to the input field).
Would it help to have a ssh log in the win exe so i can provide those?
A little update:
I found the log through the agent code and added the logging options for the output of the ssh command:
[2026-01-12T07:49:19.152Z] [INFO] [[AgentDetector]] Detecting agents on remote host: 87.xx.xxx.xx
[2026-01-12T07:49:20.075Z] [INFO] [[AgentDetector]] Executing SSH detection command for 'claude' {"command":"ssh","args":["-tt","-i","XXX","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","-o","ConnectTimeout=10","-o","ClearAllForwardings=yes","-o","RequestTTY=force","-o","LogLevel=ERROR","[email protected]","$SHELL -ilc \"which 'claude'\""],"fullCommand":"ssh -tt -i keyfile -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=10 -o ClearAllForwardings=yes -o RequestTTY=force -o LogLevel=ERROR [email protected] $SHELL -ilc \"which 'claude'\""}
[2026-01-12T07:49:20.997Z] [INFO] [[AgentDetector]] SSH command result for 'claude' {"exitCode":1,"stdout":"","stderr":"Command failed: ssh -tt -i keyfile -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=10 -o ClearAllForwardings=yes -o RequestTTY=force -o LogLevel=ERROR [email protected] $SHELL -ilc \"which 'claude'\"\n","stdoutLength":0,"stderrLength":258}
[2026-01-12T07:49:25.345Z] [INFO] [[AgentDetector]] Detected 0 agents on remote {"agents":["terminal","claude-code","codex","gemini-cli","qwen3-coder","opencode","aider"]}
Claude suggested to use bash instead of shell:
src/main/utils/ssh-command-builder.ts
const wrappedCommand = `$SHELL -ilc "${escapedCommand}"`;
const wrappedCommand = `bash -lc "source ~/.bashrc 2>/dev/null; ${escapedCommand}"`;
Tried to built it and it actually discovered claude with the wizard:
2026-01-12T08:07:48.522Z] [INFO] [[ssh-command-builder]] Built SSH command {"remoteCommand":"which 'claude'","wrappedCommand":"bash -lc \"source ~/.bashrc 2>/dev/null; which 'claude'\"","sshPath":"ssh","fullCommand":"ssh -tt -i keyfile -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=10 -o ClearAllForwardings=yes -o RequestTTY=force -o LogLevel=ERROR [email protected] bash -lc \"source ~/.bashrc 2>/dev/null; which 'claude'\""}
[2026-01-12T08:07:48.523Z] [INFO] [[AgentDetector]] Executing SSH detection command for 'claude' {"command":"ssh","args":["-tt","-i","keyfile","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","-o","ConnectTimeout=10","-o","ClearAllForwardings=yes","-o","RequestTTY=force","-o","LogLevel=ERROR","[email protected]","bash -lc \"source ~/.bashrc 2>/dev/null; which 'claude'\""],"fullCommand":"ssh -tt -i keyfile -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=10 -o ClearAllForwardings=yes -o RequestTTY=force -o LogLevel=ERROR [email protected] bash -lc \"source ~/.bashrc 2>/dev/null; which 'claude'\""}
[2026-01-12T08:07:49.126Z] [INFO] [[AgentDetector]] SSH command result for 'claude' {"exitCode":0,"stdout":"/usr/local/bin/claude\r\n","stderr":"","stdoutLength":23,"stderrLength":0}
[2026-01-12T08:07:49.127Z] [INFO] [[AgentDetector]] Agent "Claude Code" found on remote at: /usr/local/bin/claude
[2026-01-12T08:07:52.218Z] [INFO] [[AgentDetector]] Detected 1 agents on remote {"agents":["terminal","claude-code","codex","gemini-cli","qwen3-coder","opencode","aider"]}
Now on the next pages of the Wizard the Git Repo doesn't get recognized and the it says "claude-agent is not available".
Sometimes it's just too simple.
After some time fiddling around with the actual ssh connection i got to the point, where i can actually start to chat with the Agent (Wizard Confidence Builder), but the Agent always exited with code 1.
After a while of working around input- and output-stream for messages that are too long and adding more and more logs (thanks claude), i reproduced the error by running the actual claude spawn command manually:
root@ubuntu:/var/www/Maestro# claude --print --verbose --output-format stream-json --input-format stream-json --dangerously-skip-permissions --include-partial-messages
--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons
I'll setup a new user with keypair and claude instance tomorrow, test it out and create a clean branch for PR if it works.
AHA! Brilliant find! I can add robustness checks for this.
btw @chr1syy the full command / args is available also in the built-in system process viewer. at least while it's running
Good call - i actually didn't figure there's a built-in tool. That helps a lot figuring out why the call to claude doesn't work.
Has this issue been resolved? I'm also trying to use it via remote SSH, but it's not working.
Every time I click on Codex or Claude Code, it automatically switches back to local, and I don't have any CLI tools installed locally
@isCopyman we think it is, but not yet merged into main, you could try his branch directly:
https://github.com/pedramamini/Maestro/pull/188
run via npm run dev we'd love the feedback... also, appreciate your time/patience helping with the project!
Thank you! I will try.
@isCopyman can we get an update on if this is still an issue for you?
This got resolved in 0.15.0.