# tmux.Server.HasSession

- **Module:** tmux.Server
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-go/blob/52968a3181c1c9e6d1b26c565d4b170968ae61c0/tmux/session_lifecycle.go#L128
- **Page:** https://libtmux.org/en/go/latest/reference/tmux-server-hassession/

```
tmux.Server.HasSession(ctx: context.Context, request: HasSessionRequest) -> (bool, error)
```

HasSession reports whether Target selects a session. With Pattern false it compares session names exactly; with Pattern true, tmux may resolve IDs, client TTYs, unique prefixes, or globs. Pattern-mode completed nonzero exits are misses. Exact-name lookup treats [ErrNoServer] as a miss and returns other failures.

Exact-name lookup lists sessions because tmux's exact-match marker still
resolves identifiers and client TTYs.
