{"record":{"id":"b052efacbc63b31a","repo":"sipeed/picoclaw","slug":"onebot-send-w","errorCode":null,"errorMessage":"onebot send: %w","messagePattern":"onebot send: %w","errorType":"console","errorClass":"channels.ErrTemporary","httpStatus":null,"severity":"error","filePath":"pkg/channels/onebot/onebot.go","lineNumber":447,"sourceCode":"\t\tEcho:   echo,\n\t}\n\n\tdata, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal OneBot request: %w\", err)\n\t}\n\n\tc.writeMu.Lock()\n\t_ = conn.SetWriteDeadline(time.Now().Add(10 * time.Second))\n\terr = conn.WriteMessage(websocket.TextMessage, data)\n\t_ = conn.SetWriteDeadline(time.Time{})\n\tc.writeMu.Unlock()\n\n\tif err != nil {\n\t\tlogger.ErrorCF(\"onebot\", \"Failed to send message\", map[string]any{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn nil, fmt.Errorf(\"onebot send: %w\", channels.ErrTemporary)\n\t}\n\n\treturn nil, nil\n}\n\n// SendMedia implements the channels.MediaSender interface.\nfunc (c *OneBotChannel) SendMedia(ctx context.Context, msg bus.OutboundMediaMessage) ([]string, error) {\n\tif !c.IsRunning() {\n\t\treturn nil, channels.ErrNotRunning\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tdefault:\n\t}\n\n\tc.mu.Lock()","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/onebot/onebot.go#L429-L465","documentation":"Fired in OneBotChannel.Send when the WebSocket WriteMessage of the send-action request fails within the 10-second write deadline. The error is logged and wrapped with channels.ErrTemporary so callers can retry, since the failure is usually transient (dropped socket).","triggerScenarios":"Thrown at pkg/channels/onebot/onebot.go:447 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the send after the WebSocket reconnects","Verify the OneBot server is up and stable","Ensure write deadlines and locking are respected to avoid stale sockets"],"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"}