lingochamp/FileDownloader · error · IllegalArgumentException
can't handover the message, no master to receive this…
Error message
can't handover the message, no master to receive this message(status[%d]) size[%d]
What it means
FileDownloadMessenger.handoverMessage() throws IllegalArgumentException when a status message snapshot arrives but mTask is null — no task master is attached to receive it. This indicates the messenger was already released/cleared while a queued message was still being processed, i.e. an internal lifecycle race or misuse of the task's lifecycle.
Solutions
- Do not touch the task or its callback after it finishes/is cancelled; drop references once complete() or the listener's final callback fires.
- Avoid calling reuse()/starting a released task; create a new task.
- Keep operations on the task on a single thread; this is usually a library-internal race — update FileDownloader to the latest version where the race is fixed.
- Guard your listener callbacks to ignore callbacks after your own lifecycle considers the task done.
Example fix
// before
@Override public void warnOnMobile(BaseDownloadTask task, int sofar, int totalBytes) {
pausedTask.start();
}
// after
@Override public void warnOnMobile(BaseDownloadTask task, int sofar, int totalBytes) {
if (!isTaskActive(task)) return;
task.reuse();
task.start();
} Defensive patterns
Strategy: try-catch
Validate before calling
if (task.getStatus() != FileDownloadStatus.progress) return; // task may already be released
Try / catch
try { messengerDispatch(); } catch (IllegalArgumentException e) { Log.w(TAG, "message after release, ignored", e); } Prevention
- Stop touching task objects after their terminal callback (completed/error/paused).
- Avoid reusing a task object across threads after finishing.
- Keep the library updated; this is largely an internal race.
- Clear pending handler callbacks before releasing a task.
When it happens
Trigger: Delivering a message snapshot after the task was detached/released (task finished and recycled), or calling internal lifecycle methods after dispose.
Common situations: Listener callbacks arriving after cancel/pause and release; aggressive task recycling; interacting with the task object from multiple threads after completion.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- the download runnable must not be null!
- If you start the task manually, it means this task doesn't…
- This task is running
- This task is dirty to restart, If you want to reuse this…
- the provided mPath[ ] is invalid, can't find its directory
AI-assisted analysis of lingochamp/FileDownloader@6237a8cac1 (2026-09-08).
Data as JSON: /api/errors/f8bc73bb298209a0.
Report an issue: GitHub.
Appendix: source
Thrown at library/src/main/java/com/liulishuo/filedownloader/FileDownloadMessenger.java:254
+ " parcel queue[%d] queue-top-status[%d]",
this, queueTopTask.getId(), parcelQueue.size(), queueTopTask.getStatus());
}
mTask = null;
}
}
@Override
public void handoverMessage() {
if (mIsDiscard) {
return;
}
final MessageSnapshot message = parcelQueue.poll();
final int currentStatus = message.getStatus();
final BaseDownloadTask.IRunningTask task = mTask;
if (task == null) {
throw new IllegalArgumentException(FileDownloadUtils.formatString(
"can't handover the message, no master to receive this "
+ "message(status[%d]) size[%d]",
currentStatus, parcelQueue.size()));
}
final BaseDownloadTask originTask = task.getOrigin();
final FileDownloadListener listener = originTask.getListener();
final ITaskHunter.IMessageHandler messageHandler = task.getMessageHandler();
inspectAndHandleOverStatus(currentStatus);
if (listener == null || listener.isInvalid()) {
return;
}
if (currentStatus == FileDownloadStatus.blockComplete) {
try {View on GitHub (pinned to 6237a8cac1)