sipeed/picoclaw · error

failed to connect to OneBot and reconnect is disabled

Error message

failed to connect to OneBot and reconnect is disabled

What it means

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.

Solutions

  1. Check the OneBot implementation is running and ws_url is correct
  2. Set reconnect_interval > 0 so Start succeeds and retries happen in background
  3. Verify access tokens/network reachability and restart
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/channels/onebot/onebot.go:177 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/bac7610d6e5e0a3a. Report an issue: GitHub.

Appendix: source

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

		"ws_url": c.config.WSUrl,
	})

	c.ctx, c.cancel = context.WithCancel(ctx)

	if err := c.connect(); err != nil {
		logger.WarnCF("onebot", "Initial connection failed, will retry in background", map[string]any{
			"error": err.Error(),
		})
	} else {
		go c.listen()
		c.fetchSelfID()
	}

	if c.config.ReconnectInterval > 0 {
		go c.reconnectLoop()
	} else {
		if c.conn == nil {
			return fmt.Errorf("failed to connect to OneBot and reconnect is disabled")
		}
	}

	c.SetRunning(true)
	logger.InfoC("onebot", "OneBot channel started successfully")

	return nil
}

func (c *OneBotChannel) connect() error {
	dialer := websocket.DefaultDialer
	dialer.HandshakeTimeout = 10 * time.Second

	header := make(map[string][]string)
	if c.config.AccessToken.String() != "" {
		header["Authorization"] = []string{"Bearer " + c.config.AccessToken.String()}
	}

View on GitHub (pinned to 49183d7e8d)