chenhg5/cc-connect · error
%s: invalid preview handle type %T
Error message
%s: invalid preview handle type %T
What it means
UpdateMessage type-guard failure: the previewHandle argument is not a *feishuPreviewHandle, so the card cannot be patched. Reports the unexpected dynamic type; callers must pass the handle returned by SendPreviewStart.
Source
Thrown at platform/feishu/feishu.go:5268
if errors.Is(err, errFeishuCardRateLimited) {
slog.Debug(p.tag()+": stream rich card text rate limited; skipping frame", "code", resp.Code)
return nil
}
return fmt.Errorf("%s: %w", p.tag(), err)
}
return nil
}
// UpdateMessage edits an existing card message identified by previewHandle.
// Uses the Patch API (HTTP PATCH) which is required for interactive card messages.
func (p *Platform) UpdateMessage(ctx context.Context, previewHandle any, content string) error {
if !p.useInteractiveCard {
return core.ErrNotSupported
}
h, ok := previewHandle.(*feishuPreviewHandle)
if !ok {
return fmt.Errorf("%s: invalid preview handle type %T", p.tag(), previewHandle)
}
cardJSON := ""
if isCardJSON(content) {
// Card 2.0: engine passes full card JSON directly, skip all processing.
cardJSON = content
h.mu.Lock()
h.lastContent = content
h.mu.Unlock()
} else if payload, ok := core.ParseProgressCardPayload(content); ok {
cardJSON = buildProgressCardJSONFromPayload(payload)
} else {
processed := content
if containsMarkdown(content) {
processed = preprocessFeishuMarkdown(content)
}
cardJSON = buildCardJSON(sanitizeMarkdownURLs(processed))
}View on GitHub (pinned to 4000b2338a)
Solutions
- Only pass handles returned by SendPreviewStart
- Check for handles mixed across platform adapters
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at platform/feishu/feishu.go:5268 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/3abfb08e999108a9.
Report an issue: GitHub.