chenhg5/cc-connect · error
delete reaction failed: status=%d body=%s
Error message
delete reaction failed: status=%d body=%s
What it means
The WPS Xiezuo (协作) API returned a non-200 status for the reaction-delete call — the server rejected removing a reaction (expired message, missing permission, or invalid token), with the response body included for diagnosis.
Source
Thrown at platform/wps-xiezuo/wpsxiezuo.go:996
body, _ := json.Marshal(reactionRequest{ReactionType: reactionType})
url := fmt.Sprintf("%s/v7/chats/%s/messages/%s/reactions/delete", p.baseURL, rctx.ChatID, rctx.MessageID)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(body))
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
respBody, _ := io.ReadAll(resp.Body)
return fmt.Errorf("delete reaction failed: status=%d body=%s", resp.StatusCode, string(respBody))
}
return nil
}
// --- Optional interface: ReplyContextReconstructor ---
func (p *Platform) ReconstructReplyCtx(sessionKey string) (any, error) {
// Formats:
// wps-xiezuo:{company_id}:{chat_id} - group or legacy P2P
// wps-xiezuo:{company_id}:{chat_id}:{sender_id} - P2P, user-scoped
parts := strings.SplitN(sessionKey, ":", 4)
if len(parts) < 3 || parts[0] != "wps-xiezuo" {
return nil, fmt.Errorf("wps-xiezuo: invalid session key %q", sessionKey)
}
rc := replyContext{
ChatID: parts[2],
CompanyID: parts[1],
}View on GitHub (pinned to 4000b2338a)
Solutions
- Read the status and body in the error: 401/403 means refresh the token or fix permissions; 404 means the reaction no longer exists
- Refresh the OAuth access token and retry
- Verify the reaction ID is current; re-fetch reactions before deleting
- Check the bot/user has permission to modify the target document
Defensive patterns
Strategy: try-catch
Validate before calling
if resp.StatusCode == http.StatusUnauthorized { token = refreshToken(); retry() } Try / catch
if err := deleteReaction(id); err != nil { var httpErr = err; if strings.Contains(err.Error(), "status=404") { return nil /* already deleted */ }; if strings.Contains(err.Error(), "status=401") { refreshToken(); retry() }; return httpErr } Prevention
- Refresh access tokens proactively before expiry
- Re-fetch reaction lists before deleting to ensure IDs are current
- Verify bot permissions on the target document
- Log the response body for every non-200
When it happens
Trigger: Calling the delete-reaction operation when the reaction ID is wrong/already deleted, the token is expired, or permissions on the doc/comment are insufficient.
Common situations: Stale reaction ID cached after another user removed the reaction; expired access token after hours of runtime; bot lacking edit permission on the document.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- usage endpoint returned status %d: %s
- reasonix: POST %s returned %d: %s
- gitee API returned HTTP %d
- http %d: %s
- whisper API %d: %s
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/cdd3204703cf7e40.
Report an issue: GitHub.