chenhg5/cc-connect · error
weibo: parse ws endpoint: %w
Error message
weibo: parse ws endpoint: %w
What it means
url.Parse rejected the configured Weibo WebSocket endpoint (p.wsEndpoint from config), so the connection URL for the message stream could not be built in connect. This is a static configuration error, not a runtime/network failure.
Source
Thrown at platform/weibo/weibo.go:253
case <-time.After(delay):
}
delay = min(delay*2, maxReconnect)
}
}
func (p *Platform) connect() error {
p.connMu.Lock()
defer p.connMu.Unlock()
tok, err := p.getToken()
if err != nil {
return err
}
u, err := url.Parse(p.wsEndpoint)
if err != nil {
return fmt.Errorf("weibo: parse ws endpoint: %w", err)
}
q := u.Query()
q.Set("app_id", p.appID)
q.Set("token", tok)
u.RawQuery = q.Encode()
ws, _, err := websocket.DefaultDialer.DialContext(p.ctx, u.String(), nil)
if err != nil {
return fmt.Errorf("weibo: ws dial: %w", err)
}
p.wsMu.Lock()
if p.ws != nil {
p.ws.Close()
}
p.ws = ws
p.wsMu.Unlock()
View on GitHub (pinned to 4000b2338a)
Solutions
- Correct the ws_endpoint value in config.toml so it is a valid URL (e.g. wss://...: scheme present, no stray characters)
- Validate ws_endpoint at platform construction time so misconfiguration fails fast with a clear message
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at platform/weibo/weibo.go:253 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/76c2a58abb5b492a.
Report an issue: GitHub.