{"record":{"id":"70f2015a15865fdd","repo":"chenhg5/cc-connect","slug":"weibo-token-http-d-s","errorCode":null,"errorMessage":"weibo: token HTTP %d: %s","messagePattern":"weibo: token HTTP (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/weibo/weibo.go","lineNumber":177,"sourceCode":"\treq, err := http.NewRequest(\"POST\", p.tokenEndpoint, strings.NewReader(body))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"weibo: build token request: %w\", err)\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"weibo: token request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\traw, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"weibo: read token response: %w\", err)\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"weibo: token HTTP %d: %s\", resp.StatusCode, string(raw))\n\t}\n\n\tvar tr tokenResponse\n\tif err := json.Unmarshal(raw, &tr); err != nil {\n\t\treturn \"\", fmt.Errorf(\"weibo: parse token response: %w\", err)\n\t}\n\tif tr.Data.Token == \"\" {\n\t\treturn \"\", fmt.Errorf(\"weibo: empty token in response: %s\", string(raw))\n\t}\n\n\tp.token = tr.Data.Token\n\tp.tokenExpiry = time.Now().Add(time.Duration(tr.Data.ExpireIn) * time.Second)\n\tif len(tr.Data.UID) > 0 {\n\t\tp.uid = strings.Trim(string(tr.Data.UID), `\"`)\n\t}\n\n\tslog.Debug(p.tag()+\": token refreshed\", \"expires_in\", tr.Data.ExpireIn)\n\treturn p.token, nil","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/weibo/weibo.go#L159-L195","documentation":"Non-200 status from the token endpoint, with the raw response body appended: the server processed (or rejected) the token request but answered with an error status instead of the expected 200. The body usually contains the platform's error description — invalid credentials, bad app_id, or server-side incidents — since the JSON error_code path is only reached on 200.","triggerScenarios":"Thrown at platform/weibo/weibo.go:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the included body text to identify the rejection reason","For 401/403-style answers, verify app_id/app_secret against the Weibo app console","For 5xx, retry with backoff and check the provider's status page","Avoid echoing the full body to users; log it and show a generic i18n error"],"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"}