lingochamp/FileDownloader · error · FileDownloadGiveUpRetryException
require with contentLength( ), but the backend response…
Error message
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.
What it means
Error "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." thrown in lingochamp/FileDownloader.
Solutions
- Ask the backend/CDN to return a Content-Length consistent with the requested Range (start-end) so the delivered length matches the requested length
- Verify the request's Range header and the library-computed startOffset/endOffset are correct (not corrupted by a previous partial download)
- Check that no intermediary proxy/cache rewrites the response and strips or alters Content-Length/Content-Range
- As a workaround, download the file with a single connection from offset 0 or disable range-based multi-connection download for this URL
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at library/src/main/java/com/liulishuo/filedownloader/download/FetchDataTask.java:104 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/25451b92009c7db0.
Report an issue: GitHub.
Appendix: source
Thrown at library/src/main/java/com/liulishuo/filedownloader/download/FetchDataTask.java:104
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.",
range, this.contentLength, contentLength, downloadId, connectionIndex));
}
final long fetchBeginOffset = currentOffset;
// start fetch
InputStream inputStream = null;
FileDownloadOutputStream outputStream = null;
try {
final boolean isSupportSeek = CustomComponentHolder.getImpl().isSupportSeek();
if (hostRunnable != null && !isSupportSeek) {
throw new IllegalAccessException(
"can't using multi-download when the output stream can't support seek");
}View on GitHub (pinned to 6237a8cac1)