chenhg5/cc-connect · warning
slack: update preview: %w
Error message
slack: update preview: %w
What it means
UpdateMessage calls client.UpdateMessageContext to edit the preview message via chat.update. This error wraps any failure from that API call — message not found, message_cant_update, rate limit, invalid channel/timestamp, or network error. The preview could not be edited for this throttled update tick.
Source
Thrown at platform/slack/streaming.go:54
if err != nil {
return nil, fmt.Errorf("slack: send preview: %w", err)
}
return &slackPreviewHandle{channel: rc.channel, timestamp: ts}, nil
}
// UpdateMessage edits the preview message in place. The engine passes the handle
// returned by SendPreviewStart (not the reply context). Implements
// core.MessageUpdater.
func (p *Platform) UpdateMessage(ctx context.Context, previewHandle any, content string) error {
h, ok := previewHandle.(*slackPreviewHandle)
if !ok {
return fmt.Errorf("slack: invalid preview handle type %T", previewHandle)
}
_, _, _, err := p.client.UpdateMessageContext(ctx, h.channel, h.timestamp,
slack.MsgOptionText(core.MarkdownToSlackMrkdwn(content), false),
)
if err != nil {
return fmt.Errorf("slack: update preview: %w", err)
}
return nil
}
var (
_ core.MessageUpdater = (*Platform)(nil)
_ core.PreviewStarter = (*Platform)(nil)
)
View on GitHub (pinned to 4000b2338a)
Solutions
- Check the wrapped error: rate_limited => rely on engine throttling/backoff; message_not_found => user deleted it, re-post or stop updating
- Verify chat:write scope is still granted on the bot token
- Confirm the preview message's channel/timestamp are still valid
- Retry on transient network errors; engine throttling usually prevents persistent 429s
Example fix
// before
// preview deleted by user -> chat.update fails with message_not_found
// after
if err := p.UpdateMessage(ctx, handle, content); err != nil {
slog.Warn("slack: preview update failed, skipping tick", "err", err)
} Defensive patterns
Strategy: retry
Validate before calling
if handle == nil { return errors.New("no active preview handle") } Try / catch
err := p.UpdateMessage(ctx, handle, content)
var rl *slack.RateLimitedError
if errors.As(err, &rl) {
time.Sleep(rl.RetryAfter)
err = p.UpdateMessage(ctx, handle, content)
}
if err != nil { slog.Warn("slack: preview update failed", "err", err) } // non-fatal Prevention
- Treat preview-update failures as non-fatal; the final message still lands
- Respect Slack Retry-After on 429s
- Increase engine throttle interval if rate limits recur
- Alert when preview messages are deleted externally (message_not_found)
When it happens
Trigger: UpdateMessageContext fails: ts/channel from the handle no longer valid, the message was deleted by a user, chat:write scope missing, Slack 429 rate limiting, or ctx cancellation.
Common situations: A user deleted the in-progress preview message while the agent streamed; Slack rate limits during long streaming responses (engine throttles, but bursts still hit); token scope changes; channel archived mid-session.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- slack: send preview: %w
- stream AI card: status=%d, body=%s
- slack: resolve channel name for %s: %w
- slack: invalid reply context type %T
- slack: invalid preview handle type %T
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/b4a92b48494ea760.
Report an issue: GitHub.