Skip to content

Fix tmux socket name length exceeding filesystem limits#204

Open
Zeko369 wants to merge 1 commit into
DarthSim:masterfrom
Zeko369:fix-socket-name-length
Open

Fix tmux socket name length exceeding filesystem limits#204
Zeko369 wants to merge 1 commit into
DarthSim:masterfrom
Zeko369:fix-socket-name-length

Conversation

@Zeko369

@Zeko369 Zeko369 commented Oct 28, 2025

Copy link
Copy Markdown

Problem

When a project or branch name is long, the tmux socket path can exceed the unix-domain socket sun_path limit (104 bytes on macOS, 108 on Linux), so overmind start fails with File name too long and never starts tmux:

error connecting to /private/tmp/tmux-501/overmind-ud-2502-migrate-attribute-validation-rules-to-dashboard-cgszlXlXpWCM59i99NoRE (File name too long)

The socket name is the instance ID (overmind-<session>-<nanoid>), which tmux places under <tmux-tmpdir>/. With a 55-char session that path is 108 bytes — over the macOS limit.

Changes

1. Truncate the session to fit the actual socket-path budget. Rather than a fixed cap, the session portion of the instance ID is truncated to whatever room is left after accounting for the real tmux socket directory ($TMUX_TMPDIR or /tmp, plus tmux-<uid>, symlinks resolved) and the -<nanoid> suffix. This adapts to any uid length or custom TMUX_TMPDIR instead of assuming a particular environment; uniqueness is still guaranteed by the nanoid.

2. Clean up the command-center socket on a fatal exit. utils.Fatal calls os.Exit, which skips deferred cleanup — so when startup failed (e.g. the error above), .overmind.sock was left orphaned and the next run reported that overmind was "already running." Fatal now runs registered cleanup functions first, and the command center registers its socket teardown.

(These are two small, related startup-robustness fixes — happy to split them into separate PRs if you'd prefer.)

Testing

  • Reproduced the original failure with a 55-char project name; with the fix the socket name is truncated and overmind start runs.
  • Forced a tmux startup failure and confirmed .overmind.sock is removed on exit (previously leaked).
  • gofmt / go vet clean; go build passes.

Long project or branch names could push the tmux socket path past the
unix socket sun_path limit (104 bytes on macOS), causing 'File name too
long' errors on start. The session portion of the instance ID is now
truncated to fit a budget derived from the actual tmux socket directory
(mirroring tmux's $TMUX_TMPDIR / /tmp + tmux-<uid> logic, symlinks
resolved), so it adapts to any uid or TMUX_TMPDIR instead of a fixed cap.

Also clean up the command-center socket on a fatal exit: utils.Fatal
calls os.Exit, which skips deferred cleanup and orphaned .overmind.sock
when startup failed. Fatal now runs registered cleanup functions first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Zeko369 Zeko369 force-pushed the fix-socket-name-length branch from a52008a to 904c659 Compare June 17, 2026 14:46
Zeko369 added a commit to Zeko369/overmind that referenced this pull request Jun 17, 2026
Fork-only. Lets mise install the patched binary via github:Zeko369/overmind
without modifying the module path. Not part of DarthSim#204.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant