{"record":{"id":"06975a7f595e8959","repo":"chenhg5/cc-connect","slug":"weibo-ws-dial-w","errorCode":null,"errorMessage":"weibo: ws dial: %w","messagePattern":"weibo: ws dial: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/weibo/weibo.go","lineNumber":262,"sourceCode":"\tdefer p.connMu.Unlock()\n\n\ttok, err := p.getToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu, err := url.Parse(p.wsEndpoint)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"weibo: parse ws endpoint: %w\", err)\n\t}\n\tq := u.Query()\n\tq.Set(\"app_id\", p.appID)\n\tq.Set(\"token\", tok)\n\tu.RawQuery = q.Encode()\n\n\tws, _, err := websocket.DefaultDialer.DialContext(p.ctx, u.String(), nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"weibo: ws dial: %w\", err)\n\t}\n\n\tp.wsMu.Lock()\n\tif p.ws != nil {\n\t\tp.ws.Close()\n\t}\n\tp.ws = ws\n\tp.wsMu.Unlock()\n\n\tslog.Info(p.tag() + \": websocket connected\")\n\n\tgo p.pingLoop(ws)\n\tp.readLoop(ws)\n\treturn nil\n}\n\nfunc (p *Platform) pingLoop(ws *websocket.Conn) {\n\tticker := time.NewTicker(pingInterval)","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/weibo/weibo.go#L244-L280","documentation":"websocket.DefaultDialer.DialContext failed to establish the WebSocket connection to the Weibo realtime endpoint (network unreachable, DNS failure, expired/invalid token in the query string, or server refusal). connectLoop retries this with exponential backoff up to maxReconnect.","triggerScenarios":"Thrown at platform/weibo/weibo.go:262 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check network connectivity and DNS resolution to the Weibo ws endpoint","If the handshake returns 401/403, force a token refresh (getToken) before dialing, since the token query param may be stale","Rely on connectLoop's exponential backoff for transient outages; investigate logs if it never recovers"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}