Skip to content

[Bug] DownloadManager fails to retry/resume previous sessions and crashes on existing files #2972

@thumb2086

Description

@thumb2086

Is there an existing issue for this? (Please read the description)

  • I have searched the existing issues

Current Behavior

Previous Session Failure: Tracks added to the download queue in previous days or sessions cannot be downloaded. The app fails to re-validate or fetch fresh stream URLs for these "old" tasks.

File Conflict Deadlock: If a file already exists in the download directory, the DownloadManagerNotifier throws an exception instead of skipping or overwriting. It gets stuck in a loop: _startDownloading -> _downloadTrack (fails) -> _startDownloading.

Internal Crash: The YtDlpEngine fails with type 'Null' is not a subtype of type 'String', indicating the code is not handling empty/null metadata responses correctly when retrying tracks.

Expected Behavior

Tracks from previous sessions should be able to refresh their stream URLs and download successfully.

If a file exists, the app should either skip it (mark as complete) or offer to overwrite it, rather than throwing a "No download URL found" error.

The engine should gracefully handle null values during metadata parsing.

Steps to reproduce

Add tracks to the download queue and close the app (or wait 24 hours).

Re-open the app and try to download the pending tracks.

Observe the red exclamation mark and the infinite error log loop.

Alternatively, try to download a track that has a partial/full file already in the download folder.

Logs

// The infinite loop in DownloadManager
Exception: No download URL found for selected codec
#0 DownloadManagerNotifier._downloadTrack (package:spotube/provider/download_manager_provider.dart:198)
#1 DownloadManagerNotifier._startDownloading (package:spotube/provider/download_manager_provider.dart:271)
#2 DownloadManagerNotifier._startDownloading (package:spotube/provider/download_manager_provider.dart:275)

// The Type Crash
type 'Null' is not a subtype of type 'String'
#0 YtDlpEngine._parseInfo (package:spotube/services/youtube_engine/yt_dlp_engine.dart:53)
#1 YtDlpEngine.searchVideos. (package:spotube/services/youtube_engine/yt_dlp_engine.dart:146)

Operating System

windows

Spotube version

v5.1.1

Installation source

GitHub Releases (Binary)

Additional information

Download Engine: yt-dlp

Self grab

  • I'm ready to work on this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions