lingochamp/FileDownloader · error · IllegalArgumentException

can't recognize the intent with action

Error message

can't recognize the intent with action %s, on the current version we only support action [%s]

What it means

Raised by FileDownloadBroadcastHandler.parseIntent when a received broadcast intent's action is not ACTION_COMPLETED ("filedownloader.intent.action.completed"), the only action this version emits/understands. The %s placeholders print the unrecognized action and the list of supported actions; the faulty input is the intent action of a broadcast that was not sent by FileDownloader (or a stale/custom action).

Solutions

  1. Register your BroadcastReceiver with an IntentFilter on FileDownloadBroadcastHandler.ACTION_COMPLETED only
  2. Check intent.getAction() equals ACTION_COMPLETED before passing the intent to parseIntent
  3. Do not route broadcasts from other components or custom actions into parseIntent
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at library/src/main/java/com/liulishuo/filedownloader/services/FileDownloadBroadcastHandler.java:41 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/8469935649e71ecf. Report an issue: GitHub.

Appendix: source

Thrown at library/src/main/java/com/liulishuo/filedownloader/services/FileDownloadBroadcastHandler.java:41

import com.liulishuo.filedownloader.util.FileDownloadHelper;
import com.liulishuo.filedownloader.util.FileDownloadUtils;

/**
 * The handler broadcast from filedownloader.
 */
public class FileDownloadBroadcastHandler {
    public static final String ACTION_COMPLETED = "filedownloader.intent.action.completed";
    public static final String KEY_MODEL = "model";

    /**
     * Parse the {@code intent} from the filedownloader broadcast.
     *
     * @param intent the intent from the broadcast.
     * @return the file download model.
     */
    public static FileDownloadModel parseIntent(Intent intent) {
        if (!ACTION_COMPLETED.equals(intent.getAction())) {
            throw new IllegalArgumentException(FileDownloadUtils.
                    formatString("can't recognize the intent with action %s, on the current"
                            + " version we only support action [%s]",
                            intent.getAction(), ACTION_COMPLETED));
        }

        return intent.getParcelableExtra(KEY_MODEL);
    }

    public static void sendCompletedBroadcast(FileDownloadModel model) {
        if (model == null) throw new IllegalArgumentException();
        if (model.getStatus() != FileDownloadStatus.completed) throw new IllegalStateException();

        final Intent intent = new Intent(ACTION_COMPLETED);
        intent.putExtra(KEY_MODEL, model);

        FileDownloadHelper.getAppContext().sendBroadcast(intent);
    }
}

View on GitHub (pinned to 6237a8cac1)