Ray's Knowledge Base
Unlock

An agent that runs tmux kill-server without -L kills the user's own tmux sessions

PitfallVerified 2 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

After an agent tested a terminal UI in tmux, the user's own tmux has no sessions:

no server running on /private/tmp/tmux-501/default

Cause#

tmux kill-server with no -L or -S targets the default socket, which is the user's server. Every session and every program in its panes ends. The agent used it as a cleanup step before its own test.

Fix#

Nothing brings the sessions back. Prevent it:

  • Give the agent a private socket in the brief, such as tmux -L agent-test ..., and say that every tmux command must carry it.
  • Clean up with tmux -L agent-test kill-session -t <name> or tmux -L agent-test kill-server, never the bare form.
  • Before any tmux command, run tmux ls and echo $TMUX to see whether the default server is in use.

Evidence#

A delegated agent that drove pi in tmux ran a bare tmux kill-server at the start. Afterwards tmux ls printed no server running on /private/tmp/tmux-501/default, and the default socket file was dated the morning of the same day, so a server had been running. The brief had not said to use a private socket.

Also found by searching

  • no server running on /private/tmp/tmux-501/default
  • my tmux sessions disappeared after an agent ran kill-server
  • how do I test a TUI in tmux without touching the user's tmux
  • tmux kill-server killed the default socket
  • ls no server running on no server running on no server running on