{"record":{"id":"2184f4d3921f51b0","repo":"chenhg5/cc-connect","slug":"wps-agentspace-invalid-reply-context-type","errorCode":null,"errorMessage":"wps-agentspace: invalid reply context type","messagePattern":"wps-agentspace: invalid reply context type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/wps-agentspace/wpsagentspace.go","lineNumber":202,"sourceCode":"\tp.wpsSid = decryptedSid\n\tslog.Info(\"wps-agentspace: token loaded\", \"length\", len(p.wpsSid), \"has_colons\", strings.Contains(p.wpsSid, \":\"))\n\n\tif p.deviceUuid == \"\" {\n\t\tp.deviceUuid = generateUUID()\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tp.cancel = cancel\n\n\tgo p.connectLoop(ctx)\n\treturn nil\n}\n\n// Reply sends a reply to a specific message.\nfunc (p *Platform) Reply(ctx context.Context, replyCtx any, content string) error {\n\trc, ok := replyCtx.(*replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"wps-agentspace: invalid reply context type\")\n\t}\n\treturn p.sendText(rc.ChatID, content, rc)\n}\n\n// Send sends a message to a chat.\nfunc (p *Platform) Send(ctx context.Context, replyCtx any, content string) error {\n\trc, ok := replyCtx.(*replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"wps-agentspace: invalid reply context type\")\n\t}\n\treturn p.sendText(rc.ChatID, content, rc)\n}\n\n// SendFile implements core.FileSender. The WPS Agentspace WebSocket protocol\n// has no native binary file frame, so we persist the file to a shared\n// directory and reply with a path the user can open locally.\nfunc (p *Platform) SendFile(ctx context.Context, replyCtx any, file core.FileAttachment) error {\n\trc, ok := replyCtx.(*replyContext)","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/wps-agentspace/wpsagentspace.go#L184-L220","documentation":"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).","triggerScenarios":"Thrown at platform/wps-agentspace/wpsagentspace.go:202 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}