{"record":{"id":"bac7610d6e5e0a3a","repo":"sipeed/picoclaw","slug":"failed-to-connect-to-onebot-and-reconnect-is-disab","errorCode":null,"errorMessage":"failed to connect to OneBot and reconnect is disabled","messagePattern":"failed to connect to OneBot and reconnect is disabled","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/onebot/onebot.go","lineNumber":177,"sourceCode":"\t\t\"ws_url\": c.config.WSUrl,\n\t})\n\n\tc.ctx, c.cancel = context.WithCancel(ctx)\n\n\tif err := c.connect(); err != nil {\n\t\tlogger.WarnCF(\"onebot\", \"Initial connection failed, will retry in background\", map[string]any{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t} else {\n\t\tgo c.listen()\n\t\tc.fetchSelfID()\n\t}\n\n\tif c.config.ReconnectInterval > 0 {\n\t\tgo c.reconnectLoop()\n\t} else {\n\t\tif c.conn == nil {\n\t\t\treturn fmt.Errorf(\"failed to connect to OneBot and reconnect is disabled\")\n\t\t}\n\t}\n\n\tc.SetRunning(true)\n\tlogger.InfoC(\"onebot\", \"OneBot channel started successfully\")\n\n\treturn nil\n}\n\nfunc (c *OneBotChannel) connect() error {\n\tdialer := websocket.DefaultDialer\n\tdialer.HandshakeTimeout = 10 * time.Second\n\n\theader := make(map[string][]string)\n\tif c.config.AccessToken.String() != \"\" {\n\t\theader[\"Authorization\"] = []string{\"Bearer \" + c.config.AccessToken.String()}\n\t}\n","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/onebot/onebot.go#L159-L195","documentation":"Fired in OneBotChannel.Start when the initial connect() failed and ReconnectInterval is 0 (reconnecting disabled) leaving c.conn nil. Means the channel cannot reach the OneBot endpoint and, with no background retry loop, it would never become usable, so Start fails instead of silently running.","triggerScenarios":"Thrown at pkg/channels/onebot/onebot.go:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the OneBot implementation is running and ws_url is correct","Set reconnect_interval > 0 so Start succeeds and retries happen in background","Verify access tokens/network reachability and restart"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}