{"record":{"id":"e04d1c7e4eb01024","repo":"chenhg5/cc-connect","slug":"waiting-for-ready-w","errorCode":null,"errorMessage":"waiting for ready: %w","messagePattern":"waiting for ready: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/qqbot/qqbot.go","lineNumber":767,"sourceCode":"\t\t\"d\": map[string]any{\n\t\t\t\"token\":   fmt.Sprintf(\"QQBot %s\", token),\n\t\t\t\"intents\": p.intents,\n\t\t\t\"shard\":   [2]int{0, 1},\n\t\t},\n\t}\n\tp.wsMu.Lock()\n\terr := conn.WriteJSON(identify)\n\tp.wsMu.Unlock()\n\treturn err\n}\n\nfunc (p *Platform) waitForReady(conn *websocket.Conn) error {\n\t_ = conn.SetReadDeadline(time.Now().Add(15 * time.Second))\n\tdefer func() { _ = conn.SetReadDeadline(time.Time{}) }()\n\n\tvar msg wsPayload\n\tif err := conn.ReadJSON(&msg); err != nil {\n\t\treturn fmt.Errorf(\"waiting for ready: %w\", err)\n\t}\n\tif msg.Op != opDispatch || msg.T != \"READY\" {\n\t\treturn fmt.Errorf(\"expected READY event, got op=%d t=%s\", msg.Op, msg.T)\n\t}\n\n\tvar ready struct {\n\t\tSessionID string `json:\"session_id\"`\n\t}\n\tif err := json.Unmarshal(msg.D, &ready); err != nil {\n\t\tslog.Warn(\"qqbot: failed to parse READY payload\", \"error\", err)\n\t}\n\tp.sessionID = ready.SessionID\n\tif msg.S != nil {\n\t\tp.lastSeq.Store(*msg.S)\n\t}\n\n\tslog.Info(\"qqbot: gateway READY\", \"session_id\", p.sessionID)\n\treturn nil","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/qqbot/qqbot.go#L749-L785","documentation":"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).","triggerScenarios":"conn.ReadJSON in waitForReady errors: QQ never sends READY (identify rejected silently), the 15s deadline expires, or the server closes the connection.","commonSituations":"Invalid intents in the identify payload causing silent rejection; duplicate session invalidation; network instability; QQ incident preventing READY delivery.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify identify payload contains valid token + intents before sending","typeGuard":null,"tryCatchPattern":"if err := p.waitForReady(conn); err != nil {\n    var netErr net.Error\n    if errors.As(err, &netErr) && netErr.Timeout() {\n        return retryIdentify()\n    }\n    return err\n}","preventionTips":["Confirm intents are enabled for the bot in the QQ console","Avoid duplicate sessions with the same appid","Backoff-based reconnect on READY timeout"],"tags":["websocket","handshake","timeout","qqbot"],"backgroundTag":"request-timeout","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"}