tgdrive / teldrive

Telegram Drive
MIT License
1.8k stars 266 forks source link

[Bug]: How to solve this error(panic: interface conversion: tg.MessageClass is *tg.MessageEmpty, not *tg.Message) #380

Open kangheeyaa opened 6 days ago

kangheeyaa commented 6 days ago

Describe the bug

Hello. I use Teldrive frequently and tend to update to the newest version as soon as it's released I've been using the latest version until recently, but when I rebooted the server, I got the following error. I'd like to know what the problem is and how to solve it.

Repoduction

I met this issue after rebooting the server.

Expected behavior

Normal service...

Version

1.5.4

Which Platform are you using?

Linux

Additional context

Here is docker compose logs.

teldrive | goroutine 122 [running]: teldrive | github.com/tgdrive/teldrive/pkg/services.getParts({0x21219f0, 0x4000332d00}, 0x4001061b08, {0x211f018, 0x40002a6060}, 0x4001061688) teldrive | github.com/tgdrive/teldrive/pkg/services/common.go:43 +0x51c teldrive | github.com/tgdrive/teldrive/pkg/services.(FileService).GetFileStream.func1() teldrive | github.com/tgdrive/teldrive/pkg/services/file.go:852 +0x8c teldrive | github.com/tgdrive/teldrive/pkg/services.(FileService).GetFileStream.func2({0x2121750?, 0x4000f3ad20?}) teldrive | github.com/tgdrive/teldrive/pkg/services/file.go:874 +0x24 teldrive | github.com/tgdrive/teldrive/pkg/services.(FileService).GetFileStream.RunWithAuth.func3({0x2121750, 0x4000f3ad20}) teldrive | github.com/tgdrive/teldrive/internal/tgc/run.go:40 +0x36c teldrive | github.com/gotd/td/telegram.(Client).Run.func3({0x2121750, 0x4000f3ad20}) teldrive | github.com/gotd/td@v0.111.2/telegram/connect.go:150 +0xa4 teldrive | github.com/gotd/td/telegram.(Client).Run.(CancellableGroup).Go.func6() teldrive | github.com/gotd/td@v0.111.2/tdsync/cancel_group.go:48 +0x30 teldrive | golang.org/x/sync/errgroup.(Group).Go.func1() teldrive | golang.org/x/sync@v0.8.0/errgroup/errgroup.go:78 +0x54 teldrive | created by golang.org/x/sync/errgroup.(Group).Go in goroutine 118 teldrive | golang.org/x/sync@v0.8.0/errgroup/errgroup.go:75 +0x98 teldrive | 2024/11/01 03:32:22 goose: no migrations to run. current version: 20240915121635 teldrive | 01/11/2024 03:32 AM INFO Started server http://localhost:8080 teldrive | panic: interface conversion: tg.MessageClass is tg.MessageEmpty, not tg.Message

Linden10 commented 6 days ago

Ah this is indicative of a ghost file aka you have missing files on telegram side but on the database it appears it's there when it isn't. Something must've happened to cause the file to not upload but be added to your database.

This was resolved with the latest teldrive versions sometime ago, fixing file upload checks and such.

Anyways to resolve this problem, you're going to have to use this script to manually check and remove such ghost files from your database. Instructions on how to use it and requirements to install is on the discord here: https://discord.com/channels/1142377485737148479/1260921464350179399/1261145708392874064

(Make sure to join the teldrive discord first).

Here's the link to the python script: https://gist.github.com/danieleg1/1427c2a535b4dd4a6775e0fa82431400

Make sure to read those instructions so you don't accidently delete any files that you deem important! Otherwise you might end on doing something you might regret!

I hope this helps ya out! ^^

kangheeyaa commented 6 days ago

Hello. Thank you for your advice. However, I'm not familiar with programming, so I'm not confident about executing the script properly. For now, I've downgraded to version 1.5.3, and it's working normally.... I will join the Discord and carefully read the information provided there. Thank you.

D0nnieD4rk0 commented 3 days ago

had the exact same issue and the script deleted a few files of mine. this project has lost some of its credibility as a cloud storage project but i guess thats what you get for using free* cloud storage.