# tmux.Session.Rename

- **Module:** tmux.Session
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-go/blob/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/tmux/session_lifecycle.go#L261
- **Page:** https://libtmux.org/reference/go/tmux-session-rename/

```
tmux.Session.Rename(ctx: context.Context, name: string) -> (Session, error)
```

Rename changes the receiver session's name and returns a canonical freshly materialized [Session]. If the command succeeds but refresh fails, it returns the receiver with that error. A transport or context error can be delivery-ambiguous; no rollback is attempted. Invalid names are rejected before execution and match [ErrInvalidRequest].
