chenhg5/cc-connect · error
weibo: initial token fetch: %w
Error message
weibo: initial token fetch: %w
What it means
Wrap in Start of the first refreshToken call: the platform cannot obtain an initial access token from the configured token_endpoint, so startup aborts. The chained error distinguishes the cause — invalid app_id/app_secret (error_code in response), unreachable endpoint (transport), or a non-200 HTTP status.
Source
Thrown at platform/weibo/weibo.go:110
return &Platform{
name: name,
appID: appID,
appSecret: appSecret,
tokenEndpoint: tokenEndpoint,
wsEndpoint: wsEndpoint,
allowFrom: allowFrom,
seen: make(map[string]struct{}),
}, nil
}
func (p *Platform) Name() string { return p.name }
func (p *Platform) Start(handler core.MessageHandler) error {
p.handler = handler
p.ctx, p.cancel = context.WithCancel(context.Background())
if _, err := p.refreshToken(); err != nil {
return fmt.Errorf("weibo: initial token fetch: %w", err)
}
slog.Info(p.tag()+": authenticated", "uid", p.uid)
go p.connectLoop()
return nil
}
func (p *Platform) Reply(ctx context.Context, rctx any, content string) error {
return p.sendMessage(rctx, content)
}
func (p *Platform) Send(ctx context.Context, rctx any, content string) error {
return p.sendMessage(rctx, content)
}
func (p *Platform) Stop() error {
if p.cancel != nil {
p.cancel()View on GitHub (pinned to 4000b2338a)
Solutions
- Inspect the wrapped error: credential problems require fixing app_id/app_secret; network problems require fixing connectivity to the token endpoint
- Allow overriding token_endpoint via config for regional endpoints or proxies
- Retry startup with backoff if the failure was transient
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at platform/weibo/weibo.go:110 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/cd3189186bfe3ea5.
Report an issue: GitHub.