sipeed/picoclaw · error · channels.ErrTemporary

onebot send

Error message

onebot send: %w

What it means

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).

Solutions

  1. Retry the send after the WebSocket reconnects
  2. Verify the OneBot server is up and stable
  3. Ensure write deadlines and locking are respected to avoid stale sockets
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/channels/onebot/onebot.go:447 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/b052efacbc63b31a. Report an issue: GitHub.

Appendix: source

Thrown at pkg/channels/onebot/onebot.go:447

		Echo:   echo,
	}

	data, err := json.Marshal(req)
	if err != nil {
		return nil, fmt.Errorf("failed to marshal OneBot request: %w", err)
	}

	c.writeMu.Lock()
	_ = conn.SetWriteDeadline(time.Now().Add(10 * time.Second))
	err = conn.WriteMessage(websocket.TextMessage, data)
	_ = conn.SetWriteDeadline(time.Time{})
	c.writeMu.Unlock()

	if err != nil {
		logger.ErrorCF("onebot", "Failed to send message", map[string]any{
			"error": err.Error(),
		})
		return nil, fmt.Errorf("onebot send: %w", channels.ErrTemporary)
	}

	return nil, nil
}

// SendMedia implements the channels.MediaSender interface.
func (c *OneBotChannel) SendMedia(ctx context.Context, msg bus.OutboundMediaMessage) ([]string, error) {
	if !c.IsRunning() {
		return nil, channels.ErrNotRunning
	}

	select {
	case <-ctx.Done():
		return nil, ctx.Err()
	default:
	}

	c.mu.Lock()

View on GitHub (pinned to 49183d7e8d)