{"record":{"id":"096dbc87dbad21f0","repo":"sipeed/picoclaw","slug":"failed-to-start-long-polling-w","errorCode":null,"errorMessage":"failed to start long polling: %w","messagePattern":"failed to start long polling: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/telegram/telegram.go","lineNumber":162,"sourceCode":"\nfunc telegramMediaGroupDelay(telegramCfg *config.TelegramSettings) time.Duration {\n\tif telegramCfg != nil && telegramCfg.MediaGroupDelayMS > 0 {\n\t\treturn time.Duration(telegramCfg.MediaGroupDelayMS) * time.Millisecond\n\t}\n\treturn defaultMediaGroupDelay\n}\n\nfunc (c *TelegramChannel) Start(ctx context.Context) error {\n\tlogger.InfoC(\"telegram\", \"Starting Telegram bot (polling mode)...\")\n\n\tc.ctx, c.cancel = context.WithCancel(ctx)\n\n\tupdates, err := c.bot.UpdatesViaLongPolling(c.ctx, &telego.GetUpdatesParams{\n\t\tTimeout: 30,\n\t})\n\tif err != nil {\n\t\tc.cancel()\n\t\treturn fmt.Errorf(\"failed to start long polling: %w\", err)\n\t}\n\n\tbh, err := th.NewBotHandler(c.bot, updates)\n\tif err != nil {\n\t\tc.cancel()\n\t\treturn fmt.Errorf(\"failed to create bot handler: %w\", err)\n\t}\n\tc.bh = bh\n\n\tbh.HandleMessage(func(ctx *th.Context, message telego.Message) error {\n\t\treturn c.handleMessage(ctx, &message)\n\t}, th.AnyMessage())\n\n\tc.SetRunning(true)\n\tlogger.InfoCF(\"telegram\", \"Telegram bot connected\", map[string]any{\n\t\t\"username\": c.bot.Username(),\n\t})\n","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/telegram/telegram.go#L144-L180","documentation":"Error \"failed to start long polling: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/channels/telegram/telegram.go:162 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}