{"record":{"id":"b4a92b48494ea760","repo":"chenhg5/cc-connect","slug":"slack-update-preview-w","errorCode":null,"errorMessage":"slack: update preview: %w","messagePattern":"slack: update preview: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"platform/slack/streaming.go","lineNumber":54,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"slack: send preview: %w\", err)\n\t}\n\treturn &slackPreviewHandle{channel: rc.channel, timestamp: ts}, nil\n}\n\n// UpdateMessage edits the preview message in place. The engine passes the handle\n// returned by SendPreviewStart (not the reply context). Implements\n// core.MessageUpdater.\nfunc (p *Platform) UpdateMessage(ctx context.Context, previewHandle any, content string) error {\n\th, ok := previewHandle.(*slackPreviewHandle)\n\tif !ok {\n\t\treturn fmt.Errorf(\"slack: invalid preview handle type %T\", previewHandle)\n\t}\n\t_, _, _, err := p.client.UpdateMessageContext(ctx, h.channel, h.timestamp,\n\t\tslack.MsgOptionText(core.MarkdownToSlackMrkdwn(content), false),\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"slack: update preview: %w\", err)\n\t}\n\treturn nil\n}\n\nvar (\n\t_ core.MessageUpdater = (*Platform)(nil)\n\t_ core.PreviewStarter = (*Platform)(nil)\n)\n","sourceCodeStart":36,"sourceCodeEnd":63,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/slack/streaming.go#L36-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n// preview deleted by user -> chat.update fails with message_not_found\n// after\nif err := p.UpdateMessage(ctx, handle, content); err != nil {\n    slog.Warn(\"slack: preview update failed, skipping tick\", \"err\", err)\n}","handlingStrategy":"retry","validationCode":"if handle == nil { return errors.New(\"no active preview handle\") }","typeGuard":null,"tryCatchPattern":"err := p.UpdateMessage(ctx, handle, content)\nvar rl *slack.RateLimitedError\nif errors.As(err, &rl) {\n    time.Sleep(rl.RetryAfter)\n    err = p.UpdateMessage(ctx, handle, content)\n}\nif err != nil { slog.Warn(\"slack: preview update failed\", \"err\", err) } // non-fatal","preventionTips":["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)"],"tags":["slack","api","streaming","message-update"],"backgroundTag":"api-request-failed","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"}