sipeed/picoclaw · error

no connected MaixCam devices

Error message

no connected MaixCam devices

What it means

A guard in MaixCamChannel.Send: the TCP server is running but no MaixCam device client is currently connected, so the outbound command cannot be delivered. It is a deliberate sentinel-style error for an empty client set.

Solutions

  1. Wait for the device to reconnect before sending commands
  2. Verify the MaixCam device is powered and pointed at the server's host:port
  3. Return/surface a temporary error so the caller can retry later
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/channels/maixcam/maixcam.go:262 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/755e3a28ca52ff71. Report an issue: GitHub.

Appendix: source

Thrown at pkg/channels/maixcam/maixcam.go:262

func (c *MaixCamChannel) Send(ctx context.Context, msg bus.OutboundMessage) ([]string, error) {
	if !c.IsRunning() {
		return nil, channels.ErrNotRunning
	}

	// Check ctx before entering write path
	select {
	case <-ctx.Done():
		return nil, ctx.Err()
	default:
	}

	c.clientsMux.RLock()
	defer c.clientsMux.RUnlock()

	if len(c.clients) == 0 {
		logger.WarnC("maixcam", "No MaixCam devices connected")
		return nil, fmt.Errorf("no connected MaixCam devices")
	}

	response := map[string]any{
		"type":      "command",
		"timestamp": float64(0),
		"message":   msg.Content,
		"chat_id":   msg.ChatID,
	}

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

	var sendErr error
	for conn := range c.clients {
		_ = conn.SetWriteDeadline(time.Now().Add(10 * time.Second))
		if _, err := conn.Write(data); err != nil {

View on GitHub (pinned to 49183d7e8d)