jmbannon / ytdl-sub

Lightweight tool to automate downloading and metadata generation with yt-dlp
https://ytdl-sub.readthedocs.io
GNU General Public License v3.0
1.58k stars 60 forks source link

Error: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) #982

Closed JamynShanley closed 1 month ago

JamynShanley commented 1 month ago

I believe this configuration has worked for a while, so I'm not sure why it's erroring out now. Log, config, and subscription attached.

config-and-logs.zip

[ytdl-sub] Validating subscriptions...
[ytdl-sub] An uncaught error occurred:
Traceback (most recent call last):
  File "ytdl_sub/main.py", line 29, in main
  File "ytdl_sub/main.py", line 18, in _main
  File "ytdl_sub/cli/entrypoint.py", line 244, in main
  File "ytdl_sub/cli/entrypoint.py", line 107, in _download_subscriptions_from_yaml_files
  File "ytdl_sub/subscriptions/subscription.py", line 155, in from_file_path
  File "ytdl_sub/subscriptions/subscription.py", line 64, in from_dict
  File "ytdl_sub/subscriptions/subscription.py", line 40, in from_preset
  File "ytdl_sub/subscriptions/base_subscription.py", line 78, in __init__
  File "ytdl_sub/subscriptions/base_subscription.py", line 30, in _initialize_download_archive
  File "ytdl_sub/ytdl_additions/enhanced_download_archive.py", line 442, in reinitialize
  File "ytdl_sub/ytdl_additions/enhanced_download_archive.py", line 392, in _maybe_load_download_mappings
  File "ytdl_sub/ytdl_additions/enhanced_download_archive.py", line 173, in from_file
  File "json/__init__.py", line 293, in load
  File "json/__init__.py", line 346, in loads
  File "json/decoder.py", line 337, in decode
  File "json/decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[ytdl-sub] Version 2024.04.28+1d17605
Please upload the error log file '/tmp/ytdl-sub.errors1u74xnz7' and make a Github issue at https://github.com/jmbannon/ytdl-sub/issues with your config and command/subscription yaml file to reproduce. Thanks for trying ytdl-sub!
JamynShanley commented 1 month ago

It appears to be choking on an invalid archive file.

[pid 1666426] read(32, "---\n__preset__:\n  preset: \"youtu"..., 8192) = 1005 <0.000008>
[pid 1666426] read(32, "", 8192)        = 0 <0.000006>
[pid 1666426] read(32, "", 8192)        = 0 <0.000007>
[pid 1666426] read(32, "youtube Bh7Xf3Ox7K8\n", 21) = 20 <0.000023>
[pid 1666426] read(32, "", 1)           = 0 <0.000006>
[pid 1666426] write(1, "[ytdl-sub] An uncaught error occ"..., 1239[ytdl-sub] An uncaught error occurred:
$ cat ytdl-sub-Smarter\ Every\ Day-download-archive.json
youtube Bh7Xf3Ox7K8

I'm not sure how it ended up writing a corrupted archive file, but that seems to be the core issue. Bh7Xf3Ox7K8 is a valid youtube video id for the associated channel.

jmbannon commented 1 month ago

Yep that is the reason. I think I need to find a way to prevent this, have seen this multiple times now. For now, try to manually fix it

jmbannon commented 1 month ago

Hmm actually, this looks like a yt-dlp archive which is different than a ytdl-sub archive. Not sure how that happened. Unfortunately the best way to proceed is to probably delete the archive and redownload

jmbannon commented 1 month ago

Going to close this issue out now that there's a fix. Thanks again for the bug report