lingochamp/FileDownloader · error · IllegalStateException

Fatal-Exception: You can't bind the FileDownloadService in…

Error message

Fatal-Exception: You can't bind the FileDownloadService in :filedownloader process.
 It's the invalid operation and is likely to cause unexpected problems.
 Maybe you want to use non-separate process mode for FileDownloader, More detail about non-separate mode, please move to wiki manually: https://github.com/lingochamp/FileDownloader/wiki/filedownloader.properties

What it means

Error "Fatal-Exception: You can't bind the FileDownloadService in :filedownloader process. It's the invalid operation and is likely to cause unexpected problems. Maybe you want to use non-separate process mode for FileDownloader, More detail about non-separate mode, please move to wiki manually: https://github.com/lingochamp/FileDownloader/wiki/filedownloader.properties" thrown in lingochamp/FileDownloader.

Solutions

  1. Switch to non-separate process mode: do not set 'process.non-separate=true' in filedownloader.properties so the service runs in the host process
  2. Do not call bindService/startService on FileDownloadService manually; use FileDownloader.get(context).bindService() or FileDownloader#start which handle binding correctly
  3. If a separate download process is required, perform all FileDownloader API calls from the main process only and never bind from within :filedownloader
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at library/src/main/java/com/liulishuo/filedownloader/services/BaseFileServiceUIGuard.java:135 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/072e729b868aa8b5. Report an issue: GitHub.

Appendix: source

Thrown at library/src/main/java/com/liulishuo/filedownloader/services/BaseFileServiceUIGuard.java:135

        FileDownloadEventPool.getImpl().
                asyncPublishInNewThread(new DownloadServiceConnectChangedEvent(
                        isLost ? DownloadServiceConnectChangedEvent.ConnectStatus.lost
                                : DownloadServiceConnectChangedEvent.ConnectStatus.disconnected,
                        serviceClass));
    }

    private final List<Context> bindContexts = new ArrayList<>();
    private final ArrayList<Runnable> connectedRunnableList = new ArrayList<>();

    @Override
    public void bindStartByContext(final Context context) {
        bindStartByContext(context, null);
    }

    @Override
    public void bindStartByContext(final Context context, final Runnable connectedRunnable) {
        if (FileDownloadUtils.isDownloaderProcess(context)) {
            throw new IllegalStateException("Fatal-Exception: You can't bind the "
                    + "FileDownloadService in :filedownloader process.\n It's the invalid operation"
                    + " and is likely to cause unexpected problems.\n Maybe you want to use"
                    + " non-separate process mode for FileDownloader, More detail about "
                    + "non-separate mode, please move to wiki manually:"
                    + " https://github.com/lingochamp/FileDownloader/wiki/filedownloader.properties"
            );
        }

        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "bindStartByContext %s", context.getClass().getSimpleName());
        }

        Intent i = new Intent(context, serviceClass);
        if (connectedRunnable != null) {
            if (!connectedRunnableList.contains(connectedRunnable)) {
                connectedRunnableList.add(connectedRunnable);
            }
        }

View on GitHub (pinned to 6237a8cac1)