chenhg5/cc-connect · error
multiple active sessions; must specify --session to send att
Error message
multiple active sessions; must specify --session to send attachments
What it means
When sending attachments, resolveSendTarget needs a single unambiguous session to bind to. If multiple interactive sessions are active and no explicit session key was provided, the engine refuses to guess and asks the caller to specify --session. This prevents attachments being delivered to the wrong conversation.
Source
Thrown at core/engine.go:11375
resolvedSessionKey := sessionKey
var state *interactiveState
if sessionKey != "" {
state = e.interactiveStates[sessionKey]
if state == nil && e.multiWorkspace {
if iKey := e.interactiveKeyForSessionKeyLocked(sessionKey); iKey != sessionKey {
state = e.interactiveStates[iKey]
}
}
} else if len(e.interactiveStates) == 1 {
for key, s := range e.interactiveStates {
resolvedSessionKey = key
state = s
break
}
} else if len(e.interactiveStates) > 1 && attachments {
e.interactiveMu.Unlock()
return sendTarget{}, fmt.Errorf("multiple active sessions; must specify --session to send attachments")
} else {
for key, s := range e.interactiveStates {
resolvedSessionKey = key
state = s
break
}
}
e.interactiveMu.Unlock()
var p Platform
var replyCtx any
if state != nil {
state.mu.Lock()
p = state.platform
replyCtx = state.replyCtx
state.mu.Unlock()
}
View on GitHub (pinned to 4000b2338a)
Solutions
- Pass the target session explicitly (--session flag / sessionKey argument)
- Reduce to a single active session before sending
- Enumerate active session keys and pick the intended one programmatically
Example fix
// before cc-connect send --file report.pdf // after cc-connect send --session feishu:ou_1234 --file report.pdf
Defensive patterns
Strategy: validation
Validate before calling
keys := engine.ActiveSessionKeys()
if len(keys) > 1 && sessionFlag == "" {
return fmt.Errorf("--session required; active: %v", keys)
} Prevention
- Always pass --session in scripts when more than one chat may be active
- Enumerate active sessions interactively before attachment sends
- Keep one session per automated pipeline
When it happens
Trigger: A send request with attachments and no session identifier while e.interactiveStates holds two or more live sessions.
Common situations: CLI/script sends attachments while the user has two chats open with the bot; cron jobs running while several developers each have sessions; after a refactor dropped the --session flag from the invocation.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- claudeSession: start: %w
- copilot: %q CLI not found in PATH, please install it first
- iflowSession: resolve session dir: %w
- %s
- iflow process failed: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/38e0c7be1b1f21e8.
Report an issue: GitHub.