# 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/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/tmux/session_lifecycle.go#L128
- **Page:** https://libtmux.org/reference/go/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.
