chenhg5/cc-connect · error
wps-agentspace: invalid reply context type
Error message
wps-agentspace: invalid reply context type
What it means
Reply's type assertion of replyCtx to *replyContext failed — the engine handed the WPS platform a reply context value that is not the one its own message handler produced (cross-platform context reuse or a nil/foreign value).
Source
Thrown at platform/wps-agentspace/wpsagentspace.go:202
p.wpsSid = decryptedSid
slog.Info("wps-agentspace: token loaded", "length", len(p.wpsSid), "has_colons", strings.Contains(p.wpsSid, ":"))
if p.deviceUuid == "" {
p.deviceUuid = generateUUID()
}
ctx, cancel := context.WithCancel(context.Background())
p.cancel = cancel
go p.connectLoop(ctx)
return nil
}
// Reply sends a reply to a specific message.
func (p *Platform) Reply(ctx context.Context, replyCtx any, content string) error {
rc, ok := replyCtx.(*replyContext)
if !ok {
return fmt.Errorf("wps-agentspace: invalid reply context type")
}
return p.sendText(rc.ChatID, content, rc)
}
// Send sends a message to a chat.
func (p *Platform) Send(ctx context.Context, replyCtx any, content string) error {
rc, ok := replyCtx.(*replyContext)
if !ok {
return fmt.Errorf("wps-agentspace: invalid reply context type")
}
return p.sendText(rc.ChatID, content, rc)
}
// SendFile implements core.FileSender. The WPS Agentspace WebSocket protocol
// has no native binary file frame, so we persist the file to a shared
// directory and reply with a path the user can open locally.
func (p *Platform) SendFile(ctx context.Context, replyCtx any, file core.FileAttachment) error {
rc, ok := replyCtx.(*replyContext)View on GitHub (pinned to 4000b2338a)
Solutions
- Pass back the exact *replyContext created during inbound message handling
- For cron/proactive sends, build the context via the platform's reconstruction path instead of a foreign type
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at platform/wps-agentspace/wpsagentspace.go:202 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/2184f4d3921f51b0.
Report an issue: GitHub.