Skip to content

[Bug] Files present in JSON export are missing when download finishes #1150

@nadiamoe

Description

@nadiamoe

Describe the bug

Heya,
Thanks for the work you've put on tdl, it's an amazing tool.

I'm having an issue where I'm attempting to back up files shared in a large telegram channel, about 50k files over the course of several years. I'm running two tdl commands, one to export messages as JSON, and another to download the files. However, I've observed that some files that I can see in the telegram client, and in the JSON export, are not downloaded.

To Reproduce

Export JSON with:

tdl chat export -c "$CHAT_ID" --topic "$TOPIC" -f "Media.Size < 1024*1024*1024" -o "$json"

Said command runs for 40 minutes (it's a large channel). After that, I get an understandably large JSON. Focusing on one entry in particular from now on:

jq < "$json" | grep -C3 -ie 'Redacted for privacy'
    {
      "id": 360XXX,
      "type": "message",
      "file": "Redacted for privacy.pdf"
    }

id has been redacted for privacy (this is a semi-private group), but it looks like a properly formatted integer. So does the file name. In the telegram client I can see this particular file weights a couple megabytes.

Then, I run:

tdl download -f "$json" -d /data/files -e mp4 --skip-same --restart --takeout

This takes around 7 hours, and in this case emits no logs and exits with code 0, because all this runs in a cronjob and there are no new files since the last time it ran.

Afterwards, if I check for that particular file, Redacted for privacy.pdf in /data/files, it is not there. Many other files are, but that one isn't. This does not happen for a single file, but for a couple out of 10 or 100, I haven't quantified it yet.

Expected behavior

I would expect all files present in the JSON to be downloaded, or otherwise an error to be logged about why they are not.

Version

ghcr.io/iyear/tdl:0.20.1

Version: 0.20.1
Commit: 742da1b
Date: 2025-12-15T00:19:18+08:00

go1.23.12 linux/amd64

Which OS are you running tdl on?

Linux

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions