sipeed/picoclaw · error · channels.ErrSendFailed
invalid in chatID
Error message
invalid %s in chatID: %s: %w
What it means
Raised in OneBotChannel.SendMedia when the numeric ID portion of a group:/private: chatID cannot be parsed with strconv.ParseInt, wrapping channels.ErrSendFailed; the chatID format is invalid for the OneBot API.
Solutions
- Validate chat_id format (group:<int> or private:<int>) before sending
- Check upstream callers for corrupted or legacy chat IDs
- No retry helps; fix the identifier at its source
Defensive patterns
Strategy: validation
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.
Appendix: 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)