Title: get_forum_topics crashes on ForumTopicDeleted objects · Issue #71 · hydrogram/hydrogram · GitHub
Open Graph Title: get_forum_topics crashes on ForumTopicDeleted objects · Issue #71 · hydrogram/hydrogram
X Title: get_forum_topics crashes on ForumTopicDeleted objects · Issue #71 · hydrogram/hydrogram
Description: Checklist I am sure the error is coming from Hydrogram's code and not elsewhere I have searched in the issue tracker for similar bug reports, including closed ones I ran pip3 install -U https://github.com/hydrogram/hydrogram/archive/dev....
Open Graph Description: Checklist I am sure the error is coming from Hydrogram's code and not elsewhere I have searched in the issue tracker for similar bug reports, including closed ones I ran pip3 install -U https://git...
X Description: Checklist I am sure the error is coming from Hydrogram's code and not elsewhere I have searched in the issue tracker for similar bug reports, including closed ones I ran pip3 install -U https:/...
Opengraph URL: https://github.com/hydrogram/hydrogram/issues/71
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"get_forum_topics crashes on ForumTopicDeleted objects","articleBody":"### Checklist\n\n- [x] I am sure the error is coming from Hydrogram's code and not elsewhere\n- [x] I have searched in the issue tracker for similar bug reports, including closed ones\n- [x] I ran `pip3 install -U https://github.com/hydrogram/hydrogram/archive/dev.zip` and reproduced the issue using the latest development version\n\n### Description\n\nOperating system\nWindows 10\nDebian GNU/Linux 12 (bookworm)\n\nPython version\n3.13.5\n\nhydrogram version\n0.2.0\n\nWhen calling get_forum_topics on a forum chat that contains deleted topics, Hydrogram crashes with an AttributeError. It tries to parse ForumTopicDeleted objects as if they were ForumTopic, but those don’t have the same attributes.\n\nwhat happens if you add logging to the topic parsing in the get_forum_topics function:\n\n```python\nfor _topic in r.topics:\n try:\n yield types.ForumTopic._parse(_topic)\n except Exception as e:\n print(f\"error_parse: {_topic.__class__}\")\n```\n\nlogs:\nerror_parse: \u003cclass 'hydrogram.raw.types.forum_topic_deleted.ForumTopicDeleted'\u003e\n\n### Steps to reproduce\n\n1. Create client as user\n2. Invoke get_forum_topics on a forum chat that contains deleted topics\n\n### Code example\n\n```python\nimport asyncio\nfrom hydrogram import Client\nfrom hydrogram.types import ForumTopic\n\nAPI_ID = \nAPI_HASH = \nCHAT_ID = -1233 # forum chat with deleted topics\n\nasync def main():\n async with Client(\"my_session\", api_id=API_ID, api_hash=API_HASH) as app:\n async for topic in app.get_forum_topics(CHAT_ID):\n pass\n\nasyncio.run(main())\n```\n\n### Logs\n\n```shell\nWindows:\n\nF:\\projects\\big_projects\\test_hydro\u003ef:/projects/big_projects/test_hydro/.venv/Scripts/python.exe f:/projects/big_projects/test_hydro/main.py\nTraceback (most recent call last):\n File \"f:\\projects\\big_projects\\test_hydro\\main.py\", line 49, in \u003cmodule\u003e asyncio.run(main())\n ~~~~~~~~~~~^^^^^^^^\n File \"C:\\Program Files\\Python313\\Lib\\asyncio\\runners.py\", line 195, in run \n return runner.run(main)\n ~~~~~~~~~~^^^^^^\n File \"C:\\Program Files\\Python313\\Lib\\asyncio\\runners.py\", line 118, in run \n return self._loop.run_until_complete(task)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n File \"C:\\Program Files\\Python313\\Lib\\asyncio\\base_events.py\", line 725, in run_until_complete\n return future.result()\n ~~~~~~~~~~~~~^^\n File \"f:\\projects\\big_projects\\test_hydro\\main.py\", line 37, in main \n async for topic in topics:\n pass\n File \"f:\\projects\\big_projects\\test_hydro\\.venv\\Lib\\site-packages\\hydrogram\\methods\\chats\\get_forum_topics.py\", line 71, in get_forum_topics\n yield types.ForumTopic._parse(_topic)\n ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^\n File \"f:\\projects\\big_projects\\test_hydro\\.venv\\Lib\\site-packages\\hydrogram\\types\\user_and_chats\\forum_topic.py\", line 127, in _parse\n from_id = forum_topic.from_id\n ^^^^^^^^^^^^^^^^^^^\nAttributeError: 'ForumTopicDeleted' object has no attribute 'from_id'\n\nLinux:\nTraceback (most recent call last):\n File \"/app/main.py\", line 51, in \u003cmodule\u003e\n asyncio.run(main())\n ~~~~~~~~~~~^^^^^^^^\n File \"/usr/local/lib/python3.13/asyncio/runners.py\", line 195, in run\n return runner.run(main)\n ~~~~~~~~~~^^^^^^\n File \"/usr/local/lib/python3.13/asyncio/runners.py\", line 118, in run\n return self._loop.run_until_complete(task)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n File \"/usr/local/lib/python3.13/asyncio/base_events.py\", line 725, in run_until_complete\n return future.result()\n ~~~~~~~~~~~~~^^\n File \"/app/main.py\", line 39, in main\n async for topic in topics:\n pass\n File \"/usr/local/lib/python3.13/site-packages/hydrogram/methods/chats/get_forum_topics.py\", line 71, in get_forum_topics\n yield types.ForumTopic._parse(_topic)\n ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^\n File \"/usr/local/lib/python3.13/site-packages/hydrogram/types/user_and_chats/forum_topic.py\", line 127, in _parse\n from_id = forum_topic.from_id\n ^^^^^^^^^^^^^^^^^^^\nAttributeError: 'ForumTopicDeleted' object has no attribute 'from_id'\n```","author":{"url":"https://github.com/Barabashka656","@type":"Person","name":"Barabashka656"},"datePublished":"2025-09-13T21:55:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/71/hydrogram/issues/71"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a80ca7ec-3f8a-94b2-3a09-df43ca15b1e7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC8A:59C53:AF0D55:EADEB8:69731D29 |
| html-safe-nonce | f77d0e44c9a0bef587bd163e8ffd8a48ab6f1eff2ba573a5f34f12aa490687e3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzhBOjU5QzUzOkFGMEQ1NTpFQURFQjg6Njk3MzFEMjkiLCJ2aXNpdG9yX2lkIjoiMjY2MTEyMDQ0MjI2MDIwMDc0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2d7fa2cb917be0be594a4428f4cd338fdb206598aa4598473716e5c28fbfc4d0 |
| hovercard-subject-tag | issue:3414192926 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/hydrogram/hydrogram/71/issue_layout |
| twitter:image | https://opengraph.githubassets.com/39400b0eb4133b0a9a1dcd1a62f6e17ff5ac4d4819a5c0bbddac2c62bb6f293b/hydrogram/hydrogram/issues/71 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/39400b0eb4133b0a9a1dcd1a62f6e17ff5ac4d4819a5c0bbddac2c62bb6f293b/hydrogram/hydrogram/issues/71 |
| og:image:alt | Checklist I am sure the error is coming from Hydrogram's code and not elsewhere I have searched in the issue tracker for similar bug reports, including closed ones I ran pip3 install -U https://git... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Barabashka656 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4 |
| turbo-cache-control | no-preview |
| go-import | github.com/hydrogram/hydrogram git https://github.com/hydrogram/hydrogram.git |
| octolytics-dimension-user_id | 153278131 |
| octolytics-dimension-user_login | hydrogram |
| octolytics-dimension-repository_id | 711555265 |
| octolytics-dimension-repository_nwo | hydrogram/hydrogram |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 711555265 |
| octolytics-dimension-repository_network_root_nwo | hydrogram/hydrogram |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a5e2b48bd1260476599758f5d253b5d24092ab84 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width