lingochamp/FileDownloader · error · IllegalStateException
please use #catchWarn instead
Error message
please use #catchWarn instead %d
What it means
A deprecation/contract guard in MessageSnapshotTaker: the called method no longer handles warning notifications (it only carries the id of the task). Clients must call #catchWarn instead; the %d is the download id being processed when the legacy path was hit.
Solutions
- Replace calls to the old snapshot-taking method with MessageSnapshotTaker.catchWarn(task) to capture warning snapshots
- Upgrade FileDownloader to a version where the download-flow dispatch uses catchWarn internally
- If you implement a custom download flow, route warn callbacks through catchWarn rather than the deprecated method
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshotTaker.java:107 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/b08cc87d67cab967.
Report an issue: GitHub.
Appendix: source
Thrown at library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshotTaker.java:107
}
public static MessageSnapshot takeBlockCompleted(MessageSnapshot snapshot) {
if (snapshot.getStatus() != FileDownloadStatus.completed) {
throw new IllegalStateException(
FileDownloadUtils.formatString("take block completed snapshot, must has "
+ "already be completed. %d %d",
snapshot.getId(), snapshot.getStatus()));
}
return new BlockCompleteMessage.BlockCompleteMessageImpl(snapshot);
}
public static MessageSnapshot take(byte status, FileDownloadModel model,
DownloadStatusCallback.ProcessParams processParams) {
final MessageSnapshot snapShot;
final int id = model.getId();
if (status == FileDownloadStatus.warn) {
throw new IllegalStateException(FileDownloadUtils.
formatString("please use #catchWarn instead %d", id));
}
switch (status) {
case FileDownloadStatus.pending:
if (model.isLargeFile()) {
snapShot = new LargeMessageSnapshot.PendingMessageSnapshot(id,
model.getSoFar(), model.getTotal());
} else {
snapShot = new SmallMessageSnapshot.PendingMessageSnapshot(id,
(int) model.getSoFar(), (int) model.getTotal());
}
break;
case FileDownloadStatus.started:
snapShot = new MessageSnapshot.StartedMessageSnapshot(id);
break;
case FileDownloadStatus.connected:
final String filename = model.isPathAsDirectory() ? model.getFilename() : null;View on GitHub (pinned to 6237a8cac1)