chenhg5/cc-connect · error
slack: SendFile: invalid reply context type %T
Error message
slack: SendFile: invalid reply context type %T
What it means
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.
Source
Thrown at platform/slack/slack.go:539
// SendObservation implements core.ObserverTarget for terminal session observation.
func (p *Platform) SendObservation(ctx context.Context, channelID, text string) error {
_, _, err := p.client.PostMessageContext(ctx, channelID,
slack.MsgOptionText(text, false),
slack.MsgOptionDisableLinkUnfurl(),
)
if err != nil {
return fmt.Errorf("slack: send observation: %w", err)
}
return nil
}
// SendFile uploads and sends a generic file to the channel.
// Implements core.FileSender.
func (p *Platform) SendFile(ctx context.Context, rctx any, file core.FileAttachment) error {
rc, ok := rctx.(replyContext)
if !ok {
return fmt.Errorf("slack: SendFile: invalid reply context type %T", rctx)
}
name := file.FileName
if name == "" {
name = "attachment"
}
_, err := p.client.UploadFileV2Context(ctx, slack.UploadFileV2Parameters{
Reader: bytes.NewReader(file.Data),
FileSize: len(file.Data),
Filename: name,
Channel: rc.channel,
ThreadTimestamp: rc.timestamp,
})
if err != nil {
return fmt.Errorf("slack: send file: %w", err)
}
return nilView on GitHub (pinned to 4000b2338a)
Solutions
- Pass a Slack-produced reply context
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at platform/slack/slack.go:539 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/9febd2b1f721e427.
Report an issue: GitHub.