chenhg5/cc-connect · error
weibo: empty token in response: %s
Error message
weibo: empty token in response: %s
What it means
The Weibo token endpoint responded with HTTP 200 and parseable JSON, but the data.token field inside the parsed tokenResponse was empty — the server acknowledged the request without issuing a usable token (typically expired/invalid app credentials or a server-side error returned as success) during refreshToken.
Source
Thrown at platform/weibo/weibo.go:185
return "", fmt.Errorf("weibo: token request: %w", err)
}
defer resp.Body.Close()
raw, err := io.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("weibo: read token response: %w", err)
}
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("weibo: token HTTP %d: %s", resp.StatusCode, string(raw))
}
var tr tokenResponse
if err := json.Unmarshal(raw, &tr); err != nil {
return "", fmt.Errorf("weibo: parse token response: %w", err)
}
if tr.Data.Token == "" {
return "", fmt.Errorf("weibo: empty token in response: %s", string(raw))
}
p.token = tr.Data.Token
p.tokenExpiry = time.Now().Add(time.Duration(tr.Data.ExpireIn) * time.Second)
if len(tr.Data.UID) > 0 {
p.uid = strings.Trim(string(tr.Data.UID), `"`)
}
slog.Debug(p.tag()+": token refreshed", "expires_in", tr.Data.ExpireIn)
return p.token, nil
}
func (p *Platform) getToken() (string, error) {
p.tokenMu.Lock()
tok := p.token
exp := p.tokenExpiry
p.tokenMu.Unlock()
View on GitHub (pinned to 4000b2338a)
Solutions
- Inspect the full raw response body (included in the error) for an error code or message from Weibo
- Verify the Weibo app_id and app_secret configuration
- Retry the token request after a delay; transient Weibo API issues can return empty tokens
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at platform/weibo/weibo.go:185 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/cf46a2e89531d5c1.
Report an issue: GitHub.