[GH-ISSUE #32] Failed to receive packet #25

Closed
opened 2026-02-27 04:57:10 +03:00 by kerem · 4 comments
Owner

Originally created by @kodenamekrak on GitHub (Jul 22, 2025).
Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/32

Originally assigned to: @Googolplexed0 on GitHub.

When downloading after so many songs it seems to randomly error

[∙∙●] Preparing download...                      
Failed reading packet! Failed to receive packet          ###   ERROR:  SKIPPING SONG - GENERAL DOWNLOAD ERROR   ###
traceback (most recent call last):                         
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/track.py", line 291, in download_track                                                          
stream = Zotify.get_content_stream(track, Zotify.DOWNLOAD_QUALITY)                                                       
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                            
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/zotify.py", line 58, in get_content_stream
return cls.SESSION.content_feeder().load(content_id, VorbisOnlyAudioQuality(quality), False, None)                     
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^           
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 739, in load                                                        
return self.load_track(playable_id, audio_quality_picker, preload,                                                     
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                            
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 800, in load_track                                                  
return self.load_stream(file, track, None, preload, halt_listener)                                                     
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                            
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 754, in load_stream                                                 
return CdnFeedHelper.load_track(self.__session, track, file,                                                           
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                  
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 339, in load_track                                                  
key = session.audio_key().get_audio_key(track.gid, file.file_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                              
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 274, in get_audio_key                                               
key = callback.wait_response()                                
^^^^^^^^^^^^^^^^^^^^^^^^                        
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 315, in wait_response                                               
return self.__reference.get(block=False)                       
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^              
File "/data/data/com.termux/files/usr/lib/python3.12/queue.py", line 168, in get                                  
    raise Empty                                         
_queue.Empty                                                                                                    
During handling of the above exception, another exception occurred:                                                                                                     
Traceback (most recent call last):                        
File "/data/data/com.termux/files/usr/bin/zotify", line 8, in <module>                                            
sys.exit(main())                                                 ^^^^^^                                       
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/__main__.py", line 115, in main         
args.func(args)                                       
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/app.py", line 277, in client
download_track('liked', song[TRACK][ID], None, pbar_stack)
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/track.py", line 366, in download_track                                                          
Printer.json_dump(extra_keys)                         
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/termoutput.py", line 130, in json_dump                                                          
Printer.new_print(channel, json.dumps(obj, indent=2), PrintCategory.JSON)                                     
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/termoutput.py", line 94, in new_print                                                           
msg = Printer.print_prefixes(msg, category, channel)          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/termoutput.py", line 72, in print_prefixes                                                      
msg = "#" * Printer.term_cols()-1 + "\n" + msg + "\n" + "#" * Printer.term_cols()                                     
~~~~~~~~~~~~~~~~~~~~~~~~~^~                   
TypeError: unsupported operand type(s) for -: 'str' and 'int'
Originally created by @kodenamekrak on GitHub (Jul 22, 2025). Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/32 Originally assigned to: @Googolplexed0 on GitHub. When downloading after so many songs it seems to randomly error ``` [∙∙●] Preparing download... Failed reading packet! Failed to receive packet ### ERROR: SKIPPING SONG - GENERAL DOWNLOAD ERROR ### traceback (most recent call last): File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/track.py", line 291, in download_track stream = Zotify.get_content_stream(track, Zotify.DOWNLOAD_QUALITY) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/zotify.py", line 58, in get_content_stream return cls.SESSION.content_feeder().load(content_id, VorbisOnlyAudioQuality(quality), False, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 739, in load return self.load_track(playable_id, audio_quality_picker, preload, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 800, in load_track return self.load_stream(file, track, None, preload, halt_listener) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 754, in load_stream return CdnFeedHelper.load_track(self.__session, track, file, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 339, in load_track key = session.audio_key().get_audio_key(track.gid, file.file_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 274, in get_audio_key key = callback.wait_response() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/librespot/audio/__init__.py", line 315, in wait_response return self.__reference.get(block=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/queue.py", line 168, in get raise Empty _queue.Empty During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/data/data/com.termux/files/usr/bin/zotify", line 8, in <module> sys.exit(main()) ^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/__main__.py", line 115, in main args.func(args) File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/app.py", line 277, in client download_track('liked', song[TRACK][ID], None, pbar_stack) File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/track.py", line 366, in download_track Printer.json_dump(extra_keys) File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/termoutput.py", line 130, in json_dump Printer.new_print(channel, json.dumps(obj, indent=2), PrintCategory.JSON) File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/termoutput.py", line 94, in new_print msg = Printer.print_prefixes(msg, category, channel) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/zotify/termoutput.py", line 72, in print_prefixes msg = "#" * Printer.term_cols()-1 + "\n" + msg + "\n" + "#" * Printer.term_cols() ~~~~~~~~~~~~~~~~~~~~~~~~~^~ TypeError: unsupported operand type(s) for -: 'str' and 'int' ```
kerem 2026-02-27 04:57:10 +03:00
Author
Owner

@Googolplexed0 commented on GitHub (Jul 22, 2025):

Failed reading packet! Failed to receive packet

This function usually errors out with "Failed fetching audio key!" when getting API rate limited. "Failed reading packet!" is something different and new. About how many songs did you download before this appeared? Were you using the anti-rate limit config advice from the FAQ?

TypeError: unsupported operand type(s) for -: 'str' and 'int'

This second-depth error should be fixed with f9c9196. This should let you keep downloading more tracks if the primary error occurs again. Please do more large-scale downloads and see if the error occurs multiple times in a row across multiple tracks.

<!-- gh-comment-id:3105030071 --> @Googolplexed0 commented on GitHub (Jul 22, 2025): > Failed reading packet! Failed to receive packet This function usually errors out with "Failed fetching audio key!" when getting API rate limited. "Failed reading packet!" is something different and new. About how many songs did you download before this appeared? Were you using the [anti-rate limit config advice](https://github.com/Googolplexed0/zotify?tab=readme-ov-file#what-do-i-do-if-i-see-repeated-failed-fetching-audio-key-errors) from the FAQ? > TypeError: unsupported operand type(s) for -: 'str' and 'int' This second-depth error should be fixed with f9c9196. This should let you keep downloading more tracks if the primary error occurs again. Please do more large-scale downloads and see if the error occurs multiple times in a row across multiple tracks.
Author
Owner

@LaneSBarnes commented on GitHub (Jul 28, 2025):

I also got the same "Failed reading packet! Failed to receive packet" error during a bulk download.
I had several successful downloads, then the error happened for one song, and then it continued to successfully download more songs.

I have DOWNLOAD_REAL_TIME set to true so maybe it isn't a rate limit issue 🤔. Its not a big deal though, Ill be able to retry all the failed downloads after the bulk download is done now that you have it skip and continue 👌

Ill lookout to see if it starts happening multiple times in a row. I will also start using --debug

<!-- gh-comment-id:3125538431 --> @LaneSBarnes commented on GitHub (Jul 28, 2025): I also got the same "Failed reading packet! Failed to receive packet" error during a bulk download. I had several successful downloads, then the error happened for one song, and then it continued to successfully download more songs. I have DOWNLOAD_REAL_TIME set to true so maybe it isn't a rate limit issue 🤔. Its not a big deal though, Ill be able to retry all the failed downloads after the bulk download is done now that you have it skip and continue 👌 Ill lookout to see if it starts happening multiple times in a row. I will also start using --debug
Author
Owner

@LaneSBarnes commented on GitHub (Jul 28, 2025):

I saw the error message again, but this time the song successfully downloaded and didnt give a error/stack trace.

I copied this output mid download:

[∙∙∙] Preparing download...

Failed reading packet! Failed to receive packet

Ganja White Night - Blackberries:  48%|██████████████████████████████████████████████████████████▉                                                               | 9.36M/19.4M [03:18<03:30, 49.9kB/s]

and then the download completed and the output now looks like this:

[∙∙∙] Preparing download...

Failed r[∙●∙] Fetching genre information...
[∙∙∙] Fetching lyrics...
###   SKIPPING:  LYRICS FOR "Ganja White Night - Blackberries" (LYRICS NOT AVAILABLE)   ###

[∙∙●] Converting file...
###   DOWNLOADED: "Ganja White Night_Blackberries.ogg"   ###
###   DOWNLOAD TOOK 06:51 (PLUS 0s CONVERTING)   ###

I see "Failed r" looks like the error message was overwritten a bit.

The song I downloaded plays fine and is complete and has all its metadata correct 🤔

<!-- gh-comment-id:3125711665 --> @LaneSBarnes commented on GitHub (Jul 28, 2025): I saw the error message again, but this time the song successfully downloaded and didnt give a error/stack trace. I copied this output mid download: ``` [∙∙∙] Preparing download... Failed reading packet! Failed to receive packet Ganja White Night - Blackberries: 48%|██████████████████████████████████████████████████████████▉ | 9.36M/19.4M [03:18<03:30, 49.9kB/s] ``` and then the download completed and the output now looks like this: ``` [∙∙∙] Preparing download... Failed r[∙●∙] Fetching genre information... [∙∙∙] Fetching lyrics... ### SKIPPING: LYRICS FOR "Ganja White Night - Blackberries" (LYRICS NOT AVAILABLE) ### [∙∙●] Converting file... ### DOWNLOADED: "Ganja White Night_Blackberries.ogg" ### ### DOWNLOAD TOOK 06:51 (PLUS 0s CONVERTING) ### ``` I see "Failed r" looks like the error message was overwritten a bit. The song I downloaded plays fine and is complete and has all its metadata correct 🤔
Author
Owner

@Googolplexed0 commented on GitHub (Jul 29, 2025):

The song I downloaded plays fine and is complete and has all its metadata correct 🤔

This may mean the alert is just a nuisance alarm. Probably caused by an unstable connection, but the missing/dropped packets/connection can be requested again. I can mute the underlying logger to stop the popups (see 443ddb5). If you find that one of the songs has been corrupted, please reopen this issue.

<!-- gh-comment-id:3134357026 --> @Googolplexed0 commented on GitHub (Jul 29, 2025): > The song I downloaded plays fine and is complete and has all its metadata correct 🤔 This may mean the alert is just a nuisance alarm. Probably caused by an unstable connection, but the missing/dropped packets/connection can be requested again. I can mute the underlying logger to stop the popups (see 443ddb5). If you find that one of the songs has been corrupted, please reopen this issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/zotify#25
No description provided.