sipeed/picoclaw · error · ErrTemporary

telegram send media

Error message

telegram send media: %w

What it means

Returned by TelegramChannel.SendMedia when an individual media part (photo/voice/document) failed to send even after any format fallbacks, and the per-part error is logged. The returned error wraps channels.ErrTemporary, so callers should treat it as a transient Telegram/network failure and retry the send.

Solutions

  1. Retry the media send after backoff
  2. Check the logged per-part error for rate limits or file-size rejections
  3. Verify the media store still holds the referenced files before retrying
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/channels/telegram/telegram.go:765 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/8757ff1ee8973906. Report an issue: GitHub.

Appendix: source

Thrown at pkg/channels/telegram/telegram.go:765

				ChatID:          tu.ID(chatID),
				MessageThreadID: threadID,
				Document:        telego.InputFile{File: file},
				Caption:         part.Caption,
			}
			tgResult, err = c.bot.SendDocument(ctx, params)
		}

		if tgResult != nil {
			messageIDs = append(messageIDs, strconv.Itoa(tgResult.MessageID))
		}
		file.Close()

		if err != nil {
			logger.ErrorCF("telegram", "Failed to send media", map[string]any{
				"type":  part.Type,
				"error": err.Error(),
			})
			return nil, fmt.Errorf("telegram send media: %w", channels.ErrTemporary)
		}
	}

	if hasTrackedMsg {
		c.dismissTrackedToolFeedbackMessage(ctx, trackedChatID, trackedMsgID)
	}

	return messageIDs, nil
}

func telegramCanSendMediaGroup(parts []bus.MediaPart) bool {
	if len(parts) < 2 {
		return false
	}
	for _, part := range parts {
		if part.Type != "image" {
			return false
		}

View on GitHub (pinned to 49183d7e8d)