{"record":{"id":"c5af3a1b138baa90","repo":"chenhg5/cc-connect","slug":"dingtalk-marshal-reply-w","errorCode":null,"errorMessage":"dingtalk: marshal reply: %w","messagePattern":"dingtalk: marshal reply: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/dingtalk/dingtalk.go","lineNumber":819,"sourceCode":"\t\treturn fmt.Errorf(\"dingtalk: invalid reply context type %T\", rctx)\n\t}\n\tif rc.proactive || rc.sessionWebhook == \"\" {\n\t\treturn p.sendProactiveMessage(ctx, rc, content)\n\t}\n\n\tpayload := map[string]any{\n\t\t\"msgtype\": \"text\",\n\t\t\"text\":    map[string]string{\"content\": content},\n\t}\n\tif len(atUsers) > 0 || atAll {\n\t\tpayload[\"at\"] = map[string]any{\n\t\t\t\"atUserIds\": atUsers,\n\t\t\t\"isAtAll\":   atAll,\n\t\t}\n\t}\n\tbody, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dingtalk: marshal reply: %w\", err)\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, rc.sessionWebhook, bytes.NewReader(body))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dingtalk: create request: %w\", err)\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := core.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dingtalk: send reply: %w\", err)\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"dingtalk: reply returned status %d\", resp.StatusCode)\n\t}\n\treturn nil","sourceCodeStart":801,"sourceCodeEnd":837,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/dingtalk/dingtalk.go#L801-L837","documentation":"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.","triggerScenarios":"Thrown at platform/dingtalk/dingtalk.go:819 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the reply; if persistent, check for anomalous content that breaks encoding"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}