chenhg5/cc-connect · error
%s: chatID is empty
Error message
%s: chatID is empty
What it means
SendPreviewStart found the reply context's chatID field empty after the type guard passed. Guard preventing a card preview send to an unresolved target; the caller must supply a reply context carrying a chat id.
Source
Thrown at platform/feishu/feishu.go:5067
// → returns message_id; both ids are stored on feishuPreviewHandle.
//
// If step (1) fails OR we're in thread/reply mode (Reply API doesn't accept
// card_id reference), we fall back to the inline-card-JSON path. The handle's
// cardID stays empty in that case and the engine routes EventText through the
// full-card Patch path (= original #657 behavior, no typewriter).
func (p *Platform) SendPreviewStart(ctx context.Context, rctx any, content string) (any, error) {
if !p.useInteractiveCard {
return nil, core.ErrNotSupported
}
rc, ok := rctx.(replyContext)
if !ok {
return nil, fmt.Errorf("%s: invalid reply context type %T", p.tag(), rctx)
}
chatID := rc.chatID
if chatID == "" {
return nil, fmt.Errorf("%s: chatID is empty", p.tag())
}
// Card 2.0 path: engine passes a pre-built rich card JSON; pass it through.
var cardJSON string
var sendContent string // what goes into the Im.Message.Create / Reply content field
var cardID string // cardkit-v1 entity id (empty = no streaming text path)
if isCardJSON(content) {
cardJSON = content
// Try cardkit-v1 two-step flow regardless of Reply vs Create. Both
// Im.Message.Reply and Im.Message.Create accept the {type:card,data:{card_id}}
// content schema (verified by direct API call); skipping Reply mode would
// disable cardkit-v1 streaming on every @-mention turn (the dominant case).
if id, err := p.createCardEntity(ctx, cardJSON); err == nil {
cardID = id
sendContent = fmt.Sprintf(`{"type":"card","data":{"card_id":"%s"}}`, id)
} else {
slog.Info(p.tag()+": create card entity failed, falling back to inline card JSON",
"error", err)View on GitHub (pinned to 4000b2338a)
Solutions
- Ensure the message originated from a real chat event
- Reconstruct the reply context from a valid session key
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at platform/feishu/feishu.go:5067 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/17e1308a8a7f5865.
Report an issue: GitHub.