You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Downloading status forever in offline mode #3821
Still reproducible — confirmed, with a located cause in the current (WorkManager-based) download path.
Why it gets stuck
DownloadFileUseCase.enqueueNewDownload() enqueues the OneTimeWorkRequest with no network Constraints, so the worker runs immediately even with no connectivity. Offline, DownloadFileWorker.downloadFileToTemporalFile() throws NoConnectionWithServerException, and notifyDownloadResult() maps exactly that exception to Result.retry():
if (throwable isNoConnectionWithServerException) {
Result.retry()
} else {
Result.failure()
}
A retrying worker sits in WorkManager's ENQUEUED state during backoff. The UI treats that as "downloading": PENDING_WORK_STATUS = [ENQUEUED, RUNNING, BLOCKED], and GetLiveDataForDownloadingFileUseCase reports any work in those states as an active download. So the file shows Downloading… rather than an error.
With default exponential backoff the gaps between attempts grow quickly (~30s → minutes → hours), and MAXIMUM_NUMBER_OF_RETRIES = 3, so while the device stays offline the status effectively stays Downloading… indefinitely — matching the report. The expected error view only ever appears once retries are exhausted and a later attempt runs.
Fix directions
Add a NetworkType.CONNECTED constraint to the download work request so an offline download stays in a clearly-distinct waiting/blocked presentation instead of masquerading as in-progress; and/or
Stop returning Result.retry() for NoConnectionWithServerException (or cap/shorten backoff) so offline downloads surface the download-error view as expected.
Activity
DeepDiver1975 commentedon Jun 29, 2026
Still reproducible — confirmed, with a located cause in the current (WorkManager-based) download path.
Why it gets stuck
DownloadFileUseCase.enqueueNewDownload()enqueues theOneTimeWorkRequestwith no networkConstraints, so the worker runs immediately even with no connectivity. Offline,DownloadFileWorker.downloadFileToTemporalFile()throwsNoConnectionWithServerException, andnotifyDownloadResult()maps exactly that exception toResult.retry():A retrying worker sits in WorkManager's
ENQUEUEDstate during backoff. The UI treats that as "downloading":PENDING_WORK_STATUS = [ENQUEUED, RUNNING, BLOCKED], andGetLiveDataForDownloadingFileUseCasereports any work in those states as an active download. So the file showsDownloading…rather than an error.With default exponential backoff the gaps between attempts grow quickly (~30s → minutes → hours), and
MAXIMUM_NUMBER_OF_RETRIES = 3, so while the device stays offline the status effectively staysDownloading…indefinitely — matching the report. The expected error view only ever appears once retries are exhausted and a later attempt runs.Fix directions
NetworkType.CONNECTEDconstraint to the download work request so an offline download stays in a clearly-distinct waiting/blocked presentation instead of masquerading as in-progress; and/orResult.retry()forNoConnectionWithServerException(or cap/shorten backoff) so offline downloads surface the download-error view as expected.Files:
owncloudApp/.../usecases/transfers/downloads/DownloadFileUseCase.kt,owncloudApp/.../workers/DownloadFileWorker.kt,owncloudApp/.../extensions/WorkManagerExt.kt.🤖 Generated with Claude Code