{"record":{"id":"016401a61b389841","repo":"chenhg5/cc-connect","slug":"slack-invalid-reply-context-type-t","errorCode":null,"errorMessage":"slack: invalid reply context type %T","messagePattern":"slack: invalid reply context type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/slack/slack.go","lineNumber":454,"sourceCode":"// For DM messages (channel_type=im) that are not in an Assistant thread:\n// return empty so replies go top-level (natural 1-on-1 conversation).\nfunc assistantOrThreadTS(ev *slackevents.MessageEvent) string {\n\tif ev.ThreadTimeStamp != \"\" {\n\t\t// Already in a thread (Assistant Chat tab or regular thread reply).\n\t\treturn ev.ThreadTimeStamp\n\t}\n\t// For non-DM channels, thread under the user's message.\n\tif ev.ChannelType != \"im\" {\n\t\treturn ev.TimeStamp\n\t}\n\t// DM top-level: top-level reply is natural.\n\treturn \"\"\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(\"slack: invalid reply context type %T\", rctx)\n\t}\n\n\topts := []slack.MsgOption{\n\t\tslack.MsgOptionText(core.MarkdownToSlackMrkdwn(content), false),\n\t}\n\tif rc.timestamp != \"\" {\n\t\topts = append(opts, slack.MsgOptionPostMessageParameters(slack.PostMessageParameters{ThreadTimestamp: rc.timestamp}))\n\t}\n\n\t_, _, err := p.client.PostMessageContext(ctx, rc.channel, opts...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"slack: send: %w\", err)\n\t}\n\treturn nil\n}\n\n// Send sends a new message (or threaded reply if rctx has timestamp).\n// Patched 2026-05-03: use thread_ts when present so replies in Slack Assistant","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/slack/slack.go#L436-L472","documentation":"Type-assertion guard in Slack Reply: rctx is not the platform's internal replyContext struct, indicating the reply context did not originate from Slack's message handler (nil, wrong platform, or corrupted value).","triggerScenarios":"Thrown at platform/slack/slack.go:454 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass reply contexts produced by the Slack platform itself"],"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"}