chenhg5/cc-connect · error

%s: invalid session key %q

Error message

%s: invalid session key %q

What it means

Feishu ReconstructReplyCtx guard: sessionKey does not start with this platform's name or lacks the chatID segment ('<platform>:<chatID>[:<userID>]'), so no reply context can be rebuilt — typically a foreign or corrupted persisted session key.

Source

Thrown at platform/feishu/feishu.go:4440

// PlatformHealthInfo plumbing.
func (p *Platform) IsGroupFilterDegraded() bool {
	p.mu.RLock()
	defer p.mu.RUnlock()
	return p.groupFilterDegraded
}

func stringValue(v *string) string {
	if v == nil {
		return ""
	}
	return *v
}

func (p *Platform) ReconstructReplyCtx(sessionKey string) (any, error) {
	// {platformName}:{chatID}:{userID}
	parts := strings.SplitN(sessionKey, ":", 3)
	if len(parts) < 2 || parts[0] != p.platformName {
		return nil, fmt.Errorf("%s: invalid session key %q", p.tag(), sessionKey)
	}
	rc := replyContext{chatID: parts[1], sessionKey: sessionKey}
	if len(parts) == 3 {
		if rootID, ok := parseThreadRootID(parts[2]); ok {
			rc.messageID = rootID
		}
	}
	return rc, nil
}

// RelayGroupVisibilityKey implements core.RelayGroupVisibilityTarget for
// feishu.  When the caller session key targets a feishu thread (its
// third colon-separated segment carries a non-empty "root:" or
// "thread:" prefix produced by makeSessionKey), the visibility echo
// gets routed back into that thread; otherwise the platform returns
// ("", false) so core falls back to the channel-level ":relay" default.
func (p *Platform) RelayGroupVisibilityKey(callerSessionKey string) (string, bool) {
	parts := strings.SplitN(callerSessionKey, ":", 3)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Check the source of the persisted session key
  2. Start a new session to regenerate a valid key
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at platform/feishu/feishu.go:4440 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/2a804cf7b9312a7e. Report an issue: GitHub.