Repository navigation
Commit 7b19b95
fix: report MTProto schema drift instead of a generic error code
When the server sends an object whose constructor the installed Telethon
schema does not know, Telethon raises TypeNotFoundError. Today that is
swallowed by log_and_format_error and surfaces as
An error occurred (code: CHAT-ERR-418). Check mcp_errors.log for details.
which is indistinguishable from "no such user/chat".
That confusion is expensive, because schema drift does not fail cleanly:
an unknown constructor desynchronises the whole read buffer, so only some
calls break while their neighbours keep working. In our case list_chats,
get_common_chats, resolve_username and get_full_user were failing while
get_chats, search_contacts, list_messages and send_message were fine —
which reads exactly like "that user does not exist". The reported
constructor id is often garbage from the desynchronised stream and appears
in no schema at all, so searching for it leads nowhere too.
This names the condition, states that the data did arrive and only parsing
failed, and points at the fix. Every other error keeps the existing format.
Tested: both branches covered; the new test was run against a sabotaged
implementation first and fails there, so it can actually catch a regression.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent a7bdd4d commit 7b19b95
2 files changed
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
735 | 748 | | |
736 | 749 | | |
737 | 750 | | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
738 | 760 | | |
739 | 761 | | |
740 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments