From 371074cc67a35d210ff8d854c693f8ee703893af Mon Sep 17 00:00:00 2001 From: Shaun <121695494+TechnicallyShaun@users.noreply.github.com> Date: Tue, 20 Jan 2026 21:12:21 +0000 Subject: [PATCH] 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 / - Before fix: "Error: checking session: tmux has-session: no current target" - After fix: Crew session starts successfully Co-authored-by: Shaun --- internal/tmux/tmux.go | 3 ++- internal/tmux/tmux_test.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/tmux/tmux.go b/internal/tmux/tmux.go index 435e6126..aee4533f 100644 --- a/internal/tmux/tmux.go +++ b/internal/tmux/tmux.go @@ -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") { diff --git a/internal/tmux/tmux_test.go b/internal/tmux/tmux_test.go index a1f71f00..615b7b42 100644 --- a/internal/tmux/tmux_test.go +++ b/internal/tmux/tmux_test.go @@ -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},