chenhg5/cc-connect · error
dingtalk: marshal reply: %w
Error message
dingtalk: marshal reply: %w
What it means
ReplyWithAt wraps json.Marshal failure of the text/at payload before POSTing it to the session webhook. Practically unreachable for a map of strings, but guarded so a marshal anomaly never sends a half-built payload.
Source
Thrown at platform/dingtalk/dingtalk.go:819
return fmt.Errorf("dingtalk: invalid reply context type %T", rctx)
}
if rc.proactive || rc.sessionWebhook == "" {
return p.sendProactiveMessage(ctx, rc, content)
}
payload := map[string]any{
"msgtype": "text",
"text": map[string]string{"content": content},
}
if len(atUsers) > 0 || atAll {
payload["at"] = map[string]any{
"atUserIds": atUsers,
"isAtAll": atAll,
}
}
body, err := json.Marshal(payload)
if err != nil {
return fmt.Errorf("dingtalk: marshal reply: %w", err)
}
req, err := http.NewRequestWithContext(ctx, http.MethodPost, rc.sessionWebhook, bytes.NewReader(body))
if err != nil {
return fmt.Errorf("dingtalk: create request: %w", err)
}
req.Header.Set("Content-Type", "application/json")
resp, err := core.HTTPClient.Do(req)
if err != nil {
return fmt.Errorf("dingtalk: send reply: %w", err)
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("dingtalk: reply returned status %d", resp.StatusCode)
}
return nilView on GitHub (pinned to 4000b2338a)
Solutions
- Retry the reply; if persistent, check for anomalous content that breaks encoding
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at platform/dingtalk/dingtalk.go:819 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/c5af3a1b138baa90.
Report an issue: GitHub.