sipeed/picoclaw · error
failed to create telegram bot
Error message
failed to create telegram bot: %w
What it means
Returned by NewTelegramChannel when telego.NewBot rejects the configuration — most commonly an invalid or empty bot token (Telegram's getMe validation), but any telego option failure wraps here too. The bot object is never created, so the channel cannot start.
Solutions
- Verify the bot token with @BotFather and paste the complete token (no trailing whitespace/newline)
- Unwrap the error to confirm whether it is token validation or an option failure
- If a custom base_url or proxy is configured, check that the API server URL is reachable
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/channels/telegram/telegram.go:118 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/4e0b0ebb1b5a4377.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/channels/telegram/telegram.go:118
},
}))
} else if os.Getenv("HTTP_PROXY") != "" || os.Getenv("HTTPS_PROXY") != "" {
// Use environment proxy if configured
opts = append(opts, telego.WithHTTPClient(&http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
},
}))
}
if baseURL := strings.TrimRight(strings.TrimSpace(telegramCfg.BaseURL), "/"); baseURL != "" {
opts = append(opts, telego.WithAPIServer(baseURL))
}
opts = append(opts, telego.WithLogger(logger.NewLogger("telego")))
bot, err := telego.NewBot(telegramCfg.Token.String(), opts...)
if err != nil {
return nil, fmt.Errorf("failed to create telegram bot: %w", err)
}
base := channels.NewBaseChannel(
channelName,
telegramCfg,
bus,
bc.AllowFrom,
channels.WithMaxMessageLength(4000),
channels.WithGroupTrigger(bc.GroupTrigger),
channels.WithReasoningChannelID(bc.ReasoningChannelID),
)
ch := &TelegramChannel{
BaseChannel: base,
bot: bot,
bc: bc,
chatIDs: make(map[string]int64),
tgCfg: telegramCfg,View on GitHub (pinned to 49183d7e8d)