sipeed/picoclaw · error

failed to send message

Error message

failed to send message: %w

What it means

Returned by VKChannel.Send when c.vk.MessagesSend fails for a message chunk — a VK API or transport error, logged with the peer ID before returning. Note earlier chunks in the same send may already have been delivered; messageIDs accumulated so far are returned alongside the error.

Solutions

  1. Inspect the logged VK API error (rate limit, peer blocked, token scope)
  2. Retry the send, deduplicating if the receiving side may have gotten earlier chunks
  3. Verify the bot is not blocked by the peer and has messaging permission for that chat
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/channels/vk/vk.go:237 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/3b49d86361a9f9a0. Report an issue: GitHub.

Appendix: source

Thrown at pkg/channels/vk/vk.go:237

		b := params.NewMessagesSendBuilder()
		b.Message(chunk)
		b.RandomID(0)
		b.PeerID(peerID)

		if msg.ReplyToMessageID != "" {
			if replyID, err := strconv.Atoi(msg.ReplyToMessageID); err == nil {
				b.ReplyTo(replyID)
			}
		}

		resp, err := c.vk.MessagesSend(b.Params)
		if err != nil {
			logger.ErrorCF("vk", "Failed to send message", map[string]any{
				"error":   err.Error(),
				"peer_id": peerID,
			})
			return messageIDs, fmt.Errorf("failed to send message: %w", err)
		}

		messageIDs = append(messageIDs, strconv.Itoa(resp))
	}

	return messageIDs, nil
}

func (c *VKChannel) isMentioned(msg object.MessagesMessage) bool {
	return false
}

func (c *VKChannel) stripBotMention(text string) string {
	return strings.TrimSpace(text)
}

func (c *VKChannel) getUserName(userID int) string {
	users, err := c.vk.UsersGet(api.Params{

View on GitHub (pinned to 49183d7e8d)