{"record":{"id":"74a012b2af6ba4d1","repo":"chenhg5/cc-connect","slug":"dingtalk-create-emotion-request-w","errorCode":null,"errorMessage":"dingtalk: create emotion request: %w","messagePattern":"dingtalk: create emotion request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"platform/dingtalk/dingtalk.go","lineNumber":954,"sourceCode":"\t\tOpenMsgID:          rc.messageID,\n\t\tOpenConversationID: rc.conversationId,\n\t\tEmotionType:        2,\n\t\tEmotionName:        emoji,\n\t\tTextEmotion: dingtalkTextEmotion{\n\t\t\tEmotionID:    customTextEmotionID,\n\t\t\tEmotionName:  emoji,\n\t\t\tText:         emoji,\n\t\t\tBackgroundID: customTextEmotionBackground,\n\t\t},\n\t}\n\tbody, err := json.Marshal(requestBody)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dingtalk: marshal emotion request: %w\", err)\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, \"https://api.dingtalk.com\"+path, bytes.NewReader(body))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dingtalk: create emotion request: %w\", err)\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"x-acs-dingtalk-access-token\", token)\n\n\tresp, err := p.httpClient.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dingtalk: emotion request: %w\", err)\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"dingtalk: emotion returned status %d: %s\", resp.StatusCode, string(respBody))\n\t}\n\tif len(respBody) == 0 {\n\t\treturn nil\n\t}\n\tvar result struct {","sourceCodeStart":936,"sourceCodeEnd":972,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/dingtalk/dingtalk.go#L936-L972","documentation":"This error is returned by sendEmotion when http.NewRequestWithContext fails while building the POST request to the DingTalk emotion endpoint (https://api.dingtalk.com + reply/recall path). Go's NewRequest only errors on an invalid URL or an unparsable method/body, so this indicates the constructed request itself was malformed before any network I/O happened.","triggerScenarios":"http.NewRequestWithContext returns an error in sendEmotion — only possible if the endpoint URL were malformed; since path is a hardcoded constant and the base URL is a literal, this is a defensive guard that is effectively unreachable.","commonSituations":"None for library users; would only appear if the code's hardcoded path constant became corrupt (e.g. bad local modification).","solutions":["Retry the operation; no user-side configuration can cause this","If you modified the source or path constants, restore the original endpoint URL","Report to maintainers with the full error if it reproduces on stock code"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := p.StartTyping(ctx, rctx); err != nil {\n    if strings.Contains(err.Error(), \"create emotion request\") {\n        slog.Error(\"dingtalk emotion request construction failed (unexpected)\", \"err\", err)\n    }\n}","preventionTips":["Do not modify the hardcoded endpoint path constants","Keep the platform package unmodified; report suspected bugs upstream"],"tags":["dingtalk","http","url"],"backgroundTag":"invalid-url","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}