lingochamp/FileDownloader · error · FileDownloadGiveUpRetryException

there isn't any content need to download on

Error message

there isn't any content need to download on %d-%d with the content-length is 0

What it means

Thrown from FetchDataTask.run when the server responds to the range request with a Content-Length of 0, meaning the requested downloadId/connectionIndex range contains no bytes left to fetch (e.g. the file is already fully downloaded for that range, or the backend answers an exhausted/invalid Range with an empty body). It is a FileDownloadGiveUpRetryException: the library treats the situation as unrecoverable for this connection and gives up instead of retrying.

Solutions

  1. Verify the requested startOffset/endOffset range still contains undownloaded bytes; if the file is already complete, finish the task instead of launching a fetch
  2. Check that the backend/CDN correctly implements Range requests and does not return an empty body (Content-Length: 0) for a valid range
  3. Ensure a previous partial download did not leave the database offsets pointing past the end of the file
  4. If the server genuinely has an empty resource, handle it upstream before starting the FileDownloader task
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at library/src/main/java/com/liulishuo/filedownloader/download/FetchDataTask.java:90 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of lingochamp/FileDownloader@6237a8cac1 (2026-09-08). Data as JSON: /api/errors/6eb6f7c9edae19e2. Report an issue: GitHub.

Appendix: source

Thrown at library/src/main/java/com/liulishuo/filedownloader/download/FetchDataTask.java:90

        this.database = CustomComponentHolder.getImpl().getDatabaseInstance();

        startOffset = connectionProfile.startOffset;
        endOffset = connectionProfile.endOffset;
        currentOffset = connectionProfile.currentOffset;
        contentLength = connectionProfile.contentLength;
    }

    public void run() throws IOException, IllegalAccessException, IllegalArgumentException,
            FileDownloadGiveUpRetryException {

        if (paused) return;

        long contentLength = FileDownloadUtils.findContentLength(connectionIndex, connection);
        if (contentLength == TOTAL_VALUE_IN_CHUNKED_RESOURCE) {
            contentLength = FileDownloadUtils.findContentLengthFromContentRange(connection);
        }
        if (contentLength == 0) {
            throw new FileDownloadGiveUpRetryException(FileDownloadUtils.
                    formatString(
                            "there isn't any content need to download on %d-%d with the "
                                    + "content-length is 0",
                            downloadId, connectionIndex));
        }

        if (this.contentLength > 0 && contentLength != this.contentLength) {
            final String range;
            if (endOffset == ConnectionProfile.RANGE_INFINITE) {
                range = FileDownloadUtils.formatString("range[%d-)", currentOffset);
            } else {
                range = FileDownloadUtils.formatString("range[%d-%d)", currentOffset, endOffset);
            }
            throw new FileDownloadGiveUpRetryException(FileDownloadUtils.
                    formatString("require %s with contentLength(%d), but the "
                                    + "backend response contentLength is %d on "
                                    + "downloadId[%d]-connectionIndex[%d], please ask your backend "
                                    + "dev to fix such problem.",

View on GitHub (pinned to 6237a8cac1)