sipeed/picoclaw · error · channels.ErrSendFailed

invalid %s in chatID: %s: %w

Error message

invalid %s in chatID: %s: %w

What it means

Error "invalid %s in chatID: %s: %w" thrown in sipeed/picoclaw.

Source

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

	if len(segments) == 0 {
		return nil, nil
	}

	chatID := msg.ChatID
	var action, idKey string
	var rawID string
	if rest, ok := strings.CutPrefix(chatID, "group:"); ok {
		action, idKey, rawID = "send_group_msg", "group_id", rest
	} else if rest, ok := strings.CutPrefix(chatID, "private:"); ok {
		action, idKey, rawID = "send_private_msg", "user_id", rest
	} else {
		action, idKey, rawID = "send_private_msg", "user_id", chatID
	}

	id, err := strconv.ParseInt(rawID, 10, 64)
	if err != nil {
		return nil, fmt.Errorf("invalid %s in chatID: %s: %w", idKey, chatID, channels.ErrSendFailed)
	}

	echo := fmt.Sprintf("send_%d", atomic.AddInt64(&c.echoCounter, 1))

	req := oneBotAPIRequest{
		Action: action,
		Params: map[string]any{idKey: id, "message": segments},
		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)

View on GitHub (pinned to 49183d7e8d)

When it happens

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