sipeed/picoclaw · error

telegram streaming disabled after previous draft failure

Error message

telegram streaming disabled after previous draft failure

What it means

Returned by telegramStreamer.Update: an earlier sendMessageDraft call failed and set the streamer's failed flag, so all subsequent Update calls are short-circuited. The streamer has permanently degraded for this response; the caller should stop streaming updates and let Finalize deliver the complete message.

Solutions

  1. Stop calling Update and wait for Finalize to send the full message as a regular message
  2. Check the earlier draft-failure log entry for the root cause (often client not supporting drafts)
  3. If drafts keep failing, disable streaming for this channel in config
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at pkg/channels/telegram/telegram.go:1693 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/306eca1547075829. Report an issue: GitHub.

Appendix: source

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

	bot              *telego.Bot
	chatID           int64
	threadID         int
	draftID          int
	throttleInterval time.Duration
	minGrowth        int
	lastLen          int
	lastAt           time.Time
	failed           bool
	draftTouched     bool
	mu               sync.Mutex
}

func (s *telegramStreamer) Update(ctx context.Context, content string) error {
	s.mu.Lock()
	defer s.mu.Unlock()

	if s.failed {
		return fmt.Errorf("telegram streaming disabled after previous draft failure")
	}

	// Throttle: skip if not enough time or content has passed
	now := time.Now()
	growth := len(content) - s.lastLen
	if s.lastLen > 0 && now.Sub(s.lastAt) < s.throttleInterval && growth < s.minGrowth {
		return nil
	}

	htmlContent := markdownToTelegramHTML(content)
	s.draftTouched = true

	err := s.bot.SendMessageDraft(ctx, &telego.SendMessageDraftParams{
		ChatID:          s.chatID,
		MessageThreadID: s.threadID,
		DraftID:         s.draftID,
		Text:            htmlContent,
		ParseMode:       telego.ModeHTML,

View on GitHub (pinned to 49183d7e8d)