{"record":{"id":"1a49f11a26f3ea33","repo":"HKUDS/nanobot","slug":"webhook-url-is-required-when-telegram-mode-is-webh","errorCode":null,"errorMessage":"webhook_url is required when Telegram mode is webhook","messagePattern":"webhook_url is required when Telegram mode is webhook","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"nanobot/channels/telegram/runtime.py","lineNumber":445,"sourceCode":"    webhook_secret_token: str = \"\"\n    webhook_max_connections: int = Field(default=4, ge=1, le=100)\n\n    @field_validator(\"webhook_path\")\n    @classmethod\n    def webhook_path_must_start_with_slash(cls, value: str) -> str:\n        value = value.strip() or \"/telegram\"\n        if not value.startswith(\"/\"):\n            raise ValueError('webhook_path must start with \"/\"')\n        return value\n\n    @model_validator(mode=\"after\")\n    def validate_webhook_config(self) -> \"TelegramConfig\":\n        if self.mode != \"webhook\":\n            return self\n\n        url = self.webhook_url.strip()\n        if not url:\n            raise ValueError(\"webhook_url is required when Telegram mode is webhook\")\n        parsed = urlparse(url)\n        if parsed.scheme != \"https\" or not parsed.netloc:\n            raise ValueError(\"webhook_url must be a public HTTPS URL\")\n        secret = self.webhook_secret_token.strip()\n        if not secret:\n            raise ValueError(\"webhook_secret_token is required when Telegram mode is webhook\")\n        if len(secret) > 256 or re.match(r\"^[A-Za-z0-9_-]+$\", secret) is None:\n            raise ValueError(\n                \"webhook_secret_token must be 1-256 characters using only A-Z, a-z, 0-9, _ and -\"\n            )\n        return self\n\n\nclass TelegramChannel(BaseChannel):\n    \"\"\"\n    Telegram channel using long polling or webhook mode.\n\n    Long polling is the default. Webhook mode requires a public HTTPS URL and a","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/channels/telegram/runtime.py#L427-L463","documentation":"Error \"webhook_url is required when Telegram mode is webhook\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/channels/telegram/runtime.py:445 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":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}