{"record":{"id":"28a5ff49a8f06992","repo":"chenhg5/cc-connect","slug":"matrix-invalid-reply-context-type-t","errorCode":null,"errorMessage":"matrix: invalid reply context type %T","messagePattern":"matrix: invalid reply context type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/matrix/matrix.go","lineNumber":406,"sourceCode":"\t\treturn fmt.Errorf(\"matrix: not connected\")\n\t}\n\n\t// Try E2EE path first (only available when built with goolm tag)\n\tif handled, err := p.tryEncryptAndSend(ctx, client, roomID, evtType, content); handled {\n\t\treturn err\n\t}\n\n\t_, err := client.SendMessageEvent(ctx, roomID, evtType, content)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"matrix: send: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (p *Platform) Reply(ctx context.Context, rctx any, content string) error {\n\trc, ok := rctx.(replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"matrix: invalid reply context type %T\", rctx)\n\t}\n\n\tparsed := format.RenderMarkdown(content, true, false)\n\tparsed.Body = content\n\tif content != \"\" {\n\t\tparsed.RelatesTo = &event.RelatesTo{}\n\t\tparsed.RelatesTo.SetReplyTo(rc.messageID)\n\t}\n\n\treturn p.sendRoomEvent(ctx, rc.roomID, event.EventMessage, &parsed)\n}\n\nfunc (p *Platform) Send(ctx context.Context, rctx any, content string) error {\n\trc, ok := rctx.(replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"matrix: invalid reply context type %T\", rctx)\n\t}\n","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/matrix/matrix.go#L388-L424","documentation":"Type-assertion guard in Matrix Reply: the rctx passed by the engine is not the platform's internal replyContext struct (nil or wrong type), indicating the reply context was fabricated or corrupted rather than produced by this platform's message handler.","triggerScenarios":"Thrown at platform/matrix/matrix.go:406 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass reply contexts from this platform's messages or ReconstructReplyCtx"],"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-14T05:17:10.506Z"}