Fix tmux error handling for "no current target" (#755)

When starting crew without mayor running, tmux has-session can return
"no current target" if no tmux server exists. This error was not
mapped to ErrNoServer, causing crew start to fail instead of
bootstrapping a new tmux server.

Add "no current target" to the ErrNoServer detection so crew (and
other agents) can start independently without requiring an existing
tmux session.

Reproduction:
- Ensure no tmux server running (tmux kill-server)
- Run: gt crew start <rig>/<name>
- Before fix: "Error: checking session: tmux has-session: no current target"
- After fix: Crew session starts successfully

Co-authored-by: Shaun <TechnicallyShaun@users.noreply.github.com>
This commit is contained in:
Shaun
2026-01-20 21:12:21 +00:00
committed by GitHub
parent 6966eb4c28
commit 371074cc67
2 changed files with 3 additions and 1 deletions

View File

@@ -63,7 +63,8 @@ func (t *Tmux) wrapError(err error, stderr string, args []string) error {
// Detect specific error types
if strings.Contains(stderr, "no server running") ||
strings.Contains(stderr, "error connecting to") {
strings.Contains(stderr, "error connecting to") ||
strings.Contains(stderr, "no current target") {
return ErrNoServer
}
if strings.Contains(stderr, "duplicate session") {

View File

@@ -198,6 +198,7 @@ func TestWrapError(t *testing.T) {
}{
{"no server running on /tmp/tmux-...", ErrNoServer},
{"error connecting to /tmp/tmux-...", ErrNoServer},
{"no current target", ErrNoServer},
{"duplicate session: test", ErrSessionExists},
{"session not found: test", ErrSessionNotFound},
{"can't find session: test", ErrSessionNotFound},