{"record":{"id":"9fbbe1b8c4707cfe","repo":"chenhg5/cc-connect","slug":"weibo-build-token-request-w","errorCode":null,"errorMessage":"weibo: build token request: %w","messagePattern":"weibo: build token request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/weibo/weibo.go","lineNumber":161,"sourceCode":"\t\tExpireIn int64           `json:\"expire_in\"` // seconds\n\t\tUID      json.RawMessage `json:\"uid\"`\n\t} `json:\"data\"`\n\tError     string `json:\"error\"`\n\tErrorCode int    `json:\"error_code\"`\n}\n\nfunc (p *Platform) refreshToken() (string, error) {\n\tp.tokenMu.Lock()\n\tdefer p.tokenMu.Unlock()\n\n\tif p.token != \"\" && time.Now().Before(p.tokenExpiry.Add(-tokenRenewBuf)) {\n\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","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/weibo/weibo.go#L143-L179","documentation":"Wrap of http.NewRequest while building the token-refresh POST: request construction failed, which in practice means the configured token_endpoint is not a parseable URL (bad scheme, control characters, or empty after config typo). The request is never sent, so this is a local configuration error, not a network one.","triggerScenarios":"Thrown at platform/weibo/weibo.go:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate token_endpoint in config.toml — it must be a full URL including scheme","Default the endpoint when unset (the code already falls back to defaultTokenEndpoint)","Fail fast with a clear config-error message at startup"],"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"}