chenhg5/cc-connect · error
waiting for ready: %w
Error message
waiting for ready: %w
What it means
Returned by waitForReady when reading the READY dispatch frame fails within the 15s deadline — the Hello/Identify exchange succeeded but the READY event never arrived or the read errored (close, timeout, network drop).
Source
Thrown at platform/qqbot/qqbot.go:767
"d": map[string]any{
"token": fmt.Sprintf("QQBot %s", token),
"intents": p.intents,
"shard": [2]int{0, 1},
},
}
p.wsMu.Lock()
err := conn.WriteJSON(identify)
p.wsMu.Unlock()
return err
}
func (p *Platform) waitForReady(conn *websocket.Conn) error {
_ = conn.SetReadDeadline(time.Now().Add(15 * time.Second))
defer func() { _ = conn.SetReadDeadline(time.Time{}) }()
var msg wsPayload
if err := conn.ReadJSON(&msg); err != nil {
return fmt.Errorf("waiting for ready: %w", err)
}
if msg.Op != opDispatch || msg.T != "READY" {
return fmt.Errorf("expected READY event, got op=%d t=%s", msg.Op, msg.T)
}
var ready struct {
SessionID string `json:"session_id"`
}
if err := json.Unmarshal(msg.D, &ready); err != nil {
slog.Warn("qqbot: failed to parse READY payload", "error", err)
}
p.sessionID = ready.SessionID
if msg.S != nil {
p.lastSeq.Store(*msg.S)
}
slog.Info("qqbot: gateway READY", "session_id", p.sessionID)
return nilView on GitHub (pinned to 4000b2338a)
Solutions
- Retry the connect/identify flow with backoff
- Verify the requested intents are valid and authorized for the bot app
- Check for another live session with the same credentials that may have invalidated this one
- Increase the READY deadline if the network is slow
Defensive patterns
Strategy: retry
Validate before calling
// verify identify payload contains valid token + intents before sending
Try / catch
if err := p.waitForReady(conn); err != nil {
var netErr net.Error
if errors.As(err, &netErr) && netErr.Timeout() {
return retryIdentify()
}
return err
} Prevention
- Confirm intents are enabled for the bot in the QQ console
- Avoid duplicate sessions with the same appid
- Backoff-based reconnect on READY timeout
When it happens
Trigger: conn.ReadJSON in waitForReady errors: QQ never sends READY (identify rejected silently), the 15s deadline expires, or the server closes the connection.
Common situations: Invalid intents in the identify payload causing silent rejection; duplicate session invalidation; network instability; QQ incident preventing READY delivery.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
- waiting for hello: %w
- expected op 10 (Hello), got op %d
- expected READY event, got op=%d t=%s
- wecom-ws: ack timeout
- ping timeout
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/e04d1c7e4eb01024.
Report an issue: GitHub.