chenhg5/cc-connect · error
wps-agentspace: SendImage: invalid reply context type %T
Error message
wps-agentspace: SendImage: invalid reply context type %T
What it means
Type-assertion guard in wps-agentspace SendImage: replyCtx is not the platform's *replyContext type, so the ChatID to deliver the disk-persisted image notice to is unknown.
Source
Thrown at platform/wps-agentspace/wpsagentspace.go:238
rc, ok := replyCtx.(*replyContext)
if !ok {
return fmt.Errorf("wps-agentspace: SendFile: invalid reply context type %T", replyCtx)
}
path, err := p.saveAttachment(file.FileName, file.Data)
if err != nil {
return fmt.Errorf("wps-agentspace: SendFile: %w", err)
}
notice := fmt.Sprintf("📎 文件已保存到本地:\n%s", path)
return p.sendText(rc.ChatID, notice, rc)
}
// SendImage implements core.ImageSender. Same disk-persist fallback as SendFile.
func (p *Platform) SendImage(ctx context.Context, replyCtx any, img core.ImageAttachment) error {
rc, ok := replyCtx.(*replyContext)
if !ok {
return fmt.Errorf("wps-agentspace: SendImage: invalid reply context type %T", replyCtx)
}
name := img.FileName
if name == "" {
ext := ".png"
if strings.HasPrefix(img.MimeType, "image/jpeg") {
ext = ".jpg"
} else if strings.HasPrefix(img.MimeType, "image/gif") {
ext = ".gif"
} else if strings.HasPrefix(img.MimeType, "image/webp") {
ext = ".webp"
}
name = "image_" + time.Now().Format("20060102_150405") + ext
}
path, err := p.saveAttachment(name, img.Data)
if err != nil {
return fmt.Errorf("wps-agentspace: SendImage: %w", err)View on GitHub (pinned to 4000b2338a)
Solutions
- Forward the *replyContext produced by the platform's inbound handler
- Route contexts per-platform in the engine so WPS contexts never reach other senders
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at platform/wps-agentspace/wpsagentspace.go:238 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/58b65db19260718a.
Report an issue: GitHub.