{"record":{"id":"ee6e8d1b5ff1e5e6","repo":"langchain-ai/deepagents","slug":"telegram-bot-token-is-required-deepagents-talon-t","errorCode":null,"errorMessage":"Telegram bot token is required (DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN or TELEGRAM_BOT_TOKEN)","messagePattern":"Telegram bot token is required \\(DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN or TELEGRAM_BOT_TOKEN\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/talon/deepagents_talon/channels/telegram.py","lineNumber":141,"sourceCode":"        \"\"\"Build Telegram channel configuration from Talon environment values.\n\n        Args:\n            config: Talon process configuration.\n\n        Returns:\n            Telegram channel configuration.\n\n        Raises:\n            ValueError: If the bot token is missing or exposure config is invalid.\n        \"\"\"\n        env = config.env\n        token = env.get(\"DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN\") or env.get(\"TELEGRAM_BOT_TOKEN\")\n        if not token:\n            msg = (\n                \"Telegram bot token is required \"\n                \"(DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN or TELEGRAM_BOT_TOKEN)\"\n            )\n            raise ValueError(msg)\n        session = Path(\n            env.get(\"DEEPAGENTS_TALON_TELEGRAM_SESSION_DIR\", str(config.channel_dir / \"telegram\")),\n        )\n        inbound_media_dir = Path(\n            env.get(\n                \"DEEPAGENTS_TALON_TELEGRAM_MEDIA_DIR\",\n                str(config.inbound_media_dir / \"telegram\"),\n            ),\n        )\n        outbound_media_dir = outbound_media_root_from_env(env)\n        exposure = channel_exposure_from_env(\n            env,\n            ChannelExposureEnv(\n                provider=\"Telegram\",\n                env_prefix=\"DEEPAGENTS_TALON_TELEGRAM\",\n                open_ack=OPEN_EXPOSURE_ACK_ENV,\n                require_self_operator=True,\n            ),","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/talon/deepagents_talon/channels/telegram.py#L123-L159","documentation":"The Telegram channel factory `from_talon_config` requires a bot token to authenticate with the Telegram Bot API. It reads `DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN` or falls back to `TELEGRAM_BOT_TOKEN`; if neither env var is set (in the supplied env mapping), it raises `ValueError` before constructing the channel.","triggerScenarios":"Building the Telegram channel via `from_talon_config` when neither `DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN` nor `TELEGRAM_BOT_TOKEN` is present in the `env` mapping passed in.","commonSituations":"Fresh deployments where the token was never exported; running in systemd/containers where the env file wasn't loaded; typo'd variable names; tokens stored in a secrets manager but not injected into the process environment.","solutions":["Export DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN with the token from @BotFather.","Or set the more generic TELEGRAM_BOT_TOKEN (e.g. if shared with other Telegram tooling).","Verify the variable is actually visible to the process (check your .env loading, systemd EnvironmentFile, or container env configuration)."],"exampleFix":"# before\nexport DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN=\n# after\nexport DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN=123456:ABC-DEF_your_botfather_token","handlingStrategy":"validation","validationCode":"import os\nassert os.environ.get(\"DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN\") or os.environ.get(\"TELEGRAM_BOT_TOKEN\"), (\n    \"Telegram bot token missing\"\n)","typeGuard":"def has_telegram_token(env: dict[str, str]) -> bool:\n    return bool(env.get(\"DEEPAGENTS_TALON_TELEGRAM_BOT_TOKEN\") or env.get(\"TELEGRAM_BOT_TOKEN\"))","tryCatchPattern":"try:\n    channel = TelegramChannel.from_talon_config(config, env=os.environ)\nexcept ValueError as exc:\n    logging.error(\"Telegram channel not configured: %s\", exc)\n    raise SystemExit(1)","preventionTips":["Add the token to your .env / secret manager and load it before startup","Validate required env vars at process start with a fail-fast check","Use one canonical variable name per deployment to avoid fallback confusion","Check container/systemd env injection when migrating environments"],"tags":["telegram","env-var","configuration","bot-token"],"backgroundTag":"missing-env-var","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}