{"record":{"id":"8c95d60c68f8864a","repo":"chenhg5/cc-connect","slug":"wecom-request-access-token-w","errorCode":null,"errorMessage":"wecom: request access_token: %w","messagePattern":"wecom: request access_token: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/wecom/wecom.go","lineNumber":672,"sourceCode":"\treturn nil\n}\n\nfunc (p *Platform) getAccessToken() (string, error) {\n\tp.tokenCache.mu.Lock()\n\tdefer p.tokenCache.mu.Unlock()\n\n\tif p.tokenCache.token != \"\" && time.Now().Before(p.tokenCache.expiresAt) {\n\t\treturn p.tokenCache.token, nil\n\t}\n\n\tapiURL := p.wecomAPIURL(\"/cgi-bin/gettoken\", url.Values{\n\t\t\"corpid\":     []string{p.corpID},\n\t\t\"corpsecret\": []string{p.corpSecret},\n\t})\n\n\tresp, err := p.apiClient.Get(apiURL)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"wecom: request access_token: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tvar result struct {\n\t\tErrCode     int    `json:\"errcode\"`\n\t\tErrMsg      string `json:\"errmsg\"`\n\t\tAccessToken string `json:\"access_token\"`\n\t\tExpiresIn   int    `json:\"expires_in\"`\n\t}\n\tif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {\n\t\treturn \"\", fmt.Errorf(\"wecom: decode token response: %w\", err)\n\t}\n\tif result.ErrCode != 0 {\n\t\treturn \"\", fmt.Errorf(\"wecom: get token failed: %d %s\", result.ErrCode, result.ErrMsg)\n\t}\n\n\t// Compute the cache window from expires_in with a 60-second safety\n\t// margin. When the server omits or zeroes the field, fall back to","sourceCodeStart":654,"sourceCodeEnd":690,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/wecom/wecom.go#L654-L690","documentation":"Transport-level failure of GET /cgi-bin/gettoken: the HTTP request for a new access_token did not complete (network error, DNS failure, TLS issue, timeout). It only fires after the cached token was found expired/absent, so every WeCom API call behind it will also fail until resolved.","triggerScenarios":"Thrown at platform/wecom/wecom.go:672 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the token fetch with backoff; transient outages self-heal","Check outbound connectivity and proxy config for qyapi.weixin.qq.com","Ensure corpid/corpsecret are set so the URL is well-formed","Log at error level since all platform sends depend on this token"],"exampleFix":null,"handlingStrategy":"retry","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"}