sipeed/picoclaw · error · ErrTemporary
telegram rewind media after photo failure
Error message
telegram rewind media after photo failure: %w
What it means
Returned by TelegramChannel.SendMedia during an image→document fallback: the photo send failed with PHOTO_INVALID_DIMENSIONS, and while rewinding the file reader with Seek(0, SeekStart) to retry as a document, that seek also failed. The file is closed and the whole media send aborts; the wrapped error is the seek failure, not the original photo error.
Solutions
- Retry the send — the media will be re-downloaded into a fresh reader
- Check that the media store returns seekable files (not a stream already consumed)
- If the image is genuinely corrupt, regenerate or re-fetch the source media
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/channels/telegram/telegram.go:705 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/8fbbce98f49a3acf.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/channels/telegram/telegram.go:705
"error": err.Error(),
})
continue
}
var tgResult *telego.Message
switch part.Type {
case "image":
params := &telego.SendPhotoParams{
ChatID: tu.ID(chatID),
MessageThreadID: threadID,
Photo: telego.InputFile{File: file},
Caption: part.Caption,
}
tgResult, err = c.bot.SendPhoto(ctx, params)
if err != nil && strings.Contains(err.Error(), "PHOTO_INVALID_DIMENSIONS") {
if _, seekErr := file.Seek(0, io.SeekStart); seekErr != nil {
file.Close()
return nil, fmt.Errorf("telegram rewind media after photo failure: %w", channels.ErrTemporary)
}
docParams := &telego.SendDocumentParams{
ChatID: tu.ID(chatID),
MessageThreadID: threadID,
Document: telego.InputFile{File: file},
Caption: part.Caption,
}
tgResult, err = c.bot.SendDocument(ctx, docParams)
}
case "audio":
// Send OGG files with "voice" in the filename as Telegram voice
// bubbles (SendVoice) instead of audio attachments (SendAudio).
fn := strings.ToLower(part.Filename)
if strings.Contains(fn, "voice") && (strings.HasSuffix(fn, ".ogg") || strings.HasSuffix(fn, ".oga")) {
vparams := &telego.SendVoiceParams{
ChatID: tu.ID(chatID),
MessageThreadID: threadID,View on GitHub (pinned to 49183d7e8d)