{"record":{"id":"9febd2b1f721e427","repo":"chenhg5/cc-connect","slug":"slack-sendfile-invalid-reply-context-type-t","errorCode":null,"errorMessage":"slack: SendFile: invalid reply context type %T","messagePattern":"slack: SendFile: invalid reply context type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/slack/slack.go","lineNumber":539,"sourceCode":"\n// SendObservation implements core.ObserverTarget for terminal session observation.\nfunc (p *Platform) SendObservation(ctx context.Context, channelID, text string) error {\n\t_, _, err := p.client.PostMessageContext(ctx, channelID,\n\t\tslack.MsgOptionText(text, false),\n\t\tslack.MsgOptionDisableLinkUnfurl(),\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"slack: send observation: %w\", err)\n\t}\n\treturn nil\n}\n\n// SendFile uploads and sends a generic file to the channel.\n// Implements core.FileSender.\nfunc (p *Platform) SendFile(ctx context.Context, rctx any, file core.FileAttachment) error {\n\trc, ok := rctx.(replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"slack: SendFile: invalid reply context type %T\", rctx)\n\t}\n\n\tname := file.FileName\n\tif name == \"\" {\n\t\tname = \"attachment\"\n\t}\n\n\t_, err := p.client.UploadFileV2Context(ctx, slack.UploadFileV2Parameters{\n\t\tReader:          bytes.NewReader(file.Data),\n\t\tFileSize:        len(file.Data),\n\t\tFilename:        name,\n\t\tChannel:         rc.channel,\n\t\tThreadTimestamp: rc.timestamp,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"slack: send file: %w\", err)\n\t}\n\treturn nil","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/slack/slack.go#L521-L557","documentation":"Type-assertion guard in Slack SendFile: rctx is not the platform's internal replyContext struct, so the destination channel/thread for the file upload is unknown.","triggerScenarios":"Thrown at platform/slack/slack.go:539 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a Slack-produced reply context"],"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"}