{"record":{"id":"8fe294c867fbddd3","repo":"chenhg5/cc-connect","slug":"weibo-invalid-reply-context-type-t","errorCode":null,"errorMessage":"weibo: invalid reply context type: %T","messagePattern":"weibo: invalid reply context type: %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/weibo/weibo.go","lineNumber":523,"sourceCode":"\n\treturn text, images, files\n}\n\n// --- Sending ---\n\ntype sendPayload struct {\n\tToUserID  string             `json:\"toUserId\"`\n\tText      string             `json:\"text\"`\n\tMessageID string             `json:\"messageId\"`\n\tChunkID   int                `json:\"chunkId\"`\n\tDone      bool               `json:\"done\"`\n\tInput     []messageInputItem `json:\"input,omitempty\"`\n}\n\nfunc (p *Platform) sendMessage(rctx any, content string) error {\n\trc, ok := rctx.(replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"weibo: invalid reply context type: %T\", rctx)\n\t}\n\n\tchunks := splitText(content, maxTextPerChunk)\n\tmsgID := fmt.Sprintf(\"out-%s-%d\", rc.fromUserID, time.Now().UnixMilli())\n\n\tfor i, chunk := range chunks {\n\t\tenv := map[string]any{\n\t\t\t\"type\": \"send_message\",\n\t\t\t\"payload\": sendPayload{\n\t\t\t\tToUserID:  rc.fromUserID,\n\t\t\t\tText:      chunk,\n\t\t\t\tMessageID: msgID,\n\t\t\t\tChunkID:   i,\n\t\t\t\tDone:      i == len(chunks)-1,\n\t\t\t},\n\t\t}\n\t\tif err := p.writeWS(env); err != nil {\n\t\t\treturn err","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/weibo/weibo.go#L505-L541","documentation":"A type assertion in sendMessage expected the reply context passed by the engine to be the weibo platform's internal replyContext struct, but it received some other type. This is a programming/wiring error (wrong platform's context reused across platforms), not a user-input problem.","triggerScenarios":"Thrown at platform/weibo/weibo.go:523 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the engine always passes the replyContext originally produced by the weibo platform's message handler back to sendMessage","If contexts can originate elsewhere (cron/proactive sends), reconstruct a proper replyContext via the platform's ReconstructReplyCtx instead of passing 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"}