{"record":{"id":"f3b16226c17ba35d","repo":"chenhg5/cc-connect","slug":"weibo-read-token-response-w","errorCode":null,"errorMessage":"weibo: read token response: %w","messagePattern":"weibo: read token response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/weibo/weibo.go","lineNumber":173,"sourceCode":"\t\treturn p.token, nil\n\t}\n\n\tbody := fmt.Sprintf(`{\"app_id\":\"%s\",\"app_secret\":\"%s\"}`, p.appID, p.appSecret)\n\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), `\"`)","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/weibo/weibo.go#L155-L191","documentation":"Failure reading the token-endpoint response body (io.ReadAll): the server accepted the request and started responding, but the body stream was interrupted or the connection dropped mid-read. The status line may have been received; the JSON payload is incomplete or absent.","triggerScenarios":"Thrown at platform/weibo/weibo.go:173 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the refresh — interrupted body reads are typically transient network drops","If persistent, check for proxies or middleware that truncate long-lived response streams","Log how many bytes were read before the failure to gauge truncation point"],"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"}