How to solve this? Reinstall and not flatpack version doesn't fix problem.
How many friends do you have?
I think I already had this issue with other software, usually it's just a temporary issue (few milliseconds or seconds, not persistent). The software is showing 9999 because it's reading how much new stuff you received (messages, files, likes and whatever it is) even if you don't really have that many new messages. Looks like it hangs on reading and is unable to complete it. You can always inform the developers, typically on their website they have a support form and it's done, at least this way they know the problem. Sometimes it's even inside the software itself (Report a problem, Feedback and similar).
What version are you using? From the Ubuntu repos, or from the website?
For some reason the Telegram app needs to be backported to Ubuntu repos... Leaving the users of that version pretty far behind the official release versions.
However, the Telegram.org version for Linux x64 only opens an executable - which uses the latest version and includes an Updater executable. But you aren't really installing the application to your system, just downloading it and running it from wherever you place the 2 files. (I believe the directory of choice in this case should be
You might try to download the one of these you haven't tried yet and see if the issue persists. I'm betting you're running the outdated repo backport and that would be the issue.
I also have the same issue.
What you have to do is, read all the messages
Telegram desktop shows ALL badges by default, even muted chats. Check your notification settings.