fix: detect running Claude before restarting to prevent session ID conflicts#321
Open
aronchick wants to merge 1 commit intodlorenc:mainfrom
Open
fix: detect running Claude before restarting to prevent session ID conflicts#321aronchick wants to merge 1 commit intodlorenc:mainfrom
aronchick wants to merge 1 commit intodlorenc:mainfrom
Conversation
…nflicts The 'multiclaude claude' command was failing with "Session ID already in use" error when Claude was already running in the agent context. This happened because the command would attempt to restart Claude with --session-id or --resume flags without checking if a Claude process was already active with that session ID. Changes: - Add process alive check for stored agent PID before restarting - Add double-check for any running process in the tmux pane - Provide helpful error messages with steps to exit and restart - Import syscall package for signal-based process detection The fix detects: 1. If the stored agent PID is still running 2. If a different process is running in the tmux pane Users now get clear instructions on how to properly restart Claude or attach to the existing session. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 tasks
aronchick
added a commit
to aronchick/multiclaude
that referenced
this pull request
Jan 29, 2026
Changed two error messages to start with lowercase to comply with Go's error formatting conventions (staticcheck rule ST1005): - "Claude is already running..." → "claude is already running..." - "A process..." → "a process..." These are multi-line user-facing error messages that remain helpful while following Go's convention that error strings should not be capitalized (since they may be wrapped in other error contexts). Fixes lint failures in PR dlorenc#321 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes bug where
multiclaude claudecommand fails with "Session ID already in use" error when Claude is already running in the agent context.Problem
The command would attempt to restart Claude with
--session-idor--resumeflags without checking if a Claude process was already active using that session ID. This resulted in conflicts when the session ID was already in use by a running Claude instance.Solution
Changes
syscallpackage for signal-based process detectionTest Plan
go test ./...)multiclaude claudewhen Claude is already active shows helpful errormulticlaude claudewhen Claude is not running starts it successfullyRelated Files
internal/cli/cli.go:5047- restartClaude function🤖 Generated with Claude Code