{"record":{"id":"f88fd7a0358b1ccc","repo":"sipeed/picoclaw","slug":"telegram-draft-update-w","errorCode":null,"errorMessage":"telegram draft update: %w","messagePattern":"telegram draft update: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/telegram/telegram.go","lineNumber":1718,"sourceCode":"\t\treturn nil\n\t}\n\n\thtmlContent := markdownToTelegramHTML(content)\n\ts.draftTouched = true\n\n\terr := s.bot.SendMessageDraft(ctx, &telego.SendMessageDraftParams{\n\t\tChatID:          s.chatID,\n\t\tMessageThreadID: s.threadID,\n\t\tDraftID:         s.draftID,\n\t\tText:            htmlContent,\n\t\tParseMode:       telego.ModeHTML,\n\t})\n\tif err != nil {\n\t\tlogger.WarnCF(\"telegram\", \"sendMessageDraft failed, disabling streaming\", map[string]any{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\ts.failed = true\n\t\treturn fmt.Errorf(\"telegram draft update: %w\", err)\n\t}\n\n\ts.lastLen = len(content)\n\ts.lastAt = now\n\treturn nil\n}\n\nfunc (s *telegramStreamer) Finalize(ctx context.Context, content string) error {\n\thtmlContent := markdownToTelegramHTML(content)\n\ttgMsg := tu.Message(tu.ID(s.chatID), htmlContent)\n\ttgMsg.MessageThreadID = s.threadID\n\ttgMsg.ParseMode = telego.ModeHTML\n\n\tif _, err := s.bot.SendMessage(ctx, tgMsg); err != nil {\n\t\t// Fallback to plain text\n\t\ttgMsg.ParseMode = \"\"\n\t\tif _, err = s.bot.SendMessage(ctx, tgMsg); err != nil {\n\t\t\tlogger.ErrorCF(\"telegram\", \"Finalize failed after HTML and plain-text attempts\", map[string]any{","sourceCodeStart":1700,"sourceCodeEnd":1736,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/telegram/telegram.go#L1700-L1736","documentation":"Returned by telegramStreamer.Update when bot.SendMessageDraft fails to push a draft update: the streamer logs a warning, marks itself failed (all future Updates are refused), and wraps the telego error with %w. Only this update is lost; the final message can still be delivered via Finalize.","triggerScenarios":"Thrown at pkg/channels/telegram/telegram.go:1718 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped telego error — commonly the client not supporting message drafts","Let Finalize deliver the complete response as a normal message","Disable streaming in config if the target client never supports drafts"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}