HMCL-dev/HMCL · error · IOException

Minecraft client JAR was not downloaded

Error message

Minecraft client JAR was not downloaded

What it means

GameDownloadTask.postExecute() verifies that the download actually produced a regular file at the result path. If getResult() is null (task never completed the download) or the path is not a regular file, it throws this IOException so callers do not treat a failed client JAR download as success.

Solutions

  1. Re-run the version download task and check the network/mirror used for the client JAR.
  2. Check disk free space and that no antivirus is deleting/quarantining the .jar in the versions folder.
  3. Verify the versions/<id>/<id>.jar exists and is a regular file; delete leftovers and retry.
  4. Inspect proxy/firewall settings that may drop large file downloads.

Example fix

// before
GameDownloadTask t = new GameDownloadTask(...);
await(t); // may 'finish' without a file
// after
GameDownloadTask t = new GameDownloadTask(...);
await(t);
if (t.getResult() == null || !Files.isRegularFile(t.getResult())) {
    await(new GameDownloadTask(...)); // retry once
}
Defensive patterns

Strategy: try-catch

Validate before calling

Path jar = versionsDir.resolve(id).resolve(id + ".jar"); if (!Files.isRegularFile(jar) || Files.size(jar) < 1024) reDownload();

Type guard

boolean jarReady(GameDownloadTask t) { return t.getResult() != null && Files.isRegularFile(t.getResult()); }

Try / catch

try { await(gameDownloadTask); } catch (IOException e) { if (e.getMessage().contains("not downloaded")) retryDownload(); else throw e; }

Prevention

When it happens

Trigger: postExecute() is called after GameDownloadTask ran but the JAR download failed, was cancelled, was written to a different location, or the result path points to a directory/symlink target that no longer exists.

Common situations: Network interruption during client JAR download, antivirus quarantining the JAR, disk-full preventing the write, or a broken proxy/mirror returning no file.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10). Data as JSON: /api/errors/1c1e5ce7e6cf646b. Report an issue: GitHub.

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameDownloadTask.java:101

        cacheTask.storeTo(this::setResult);
        dependencies.add(cacheTask);
    }

    /// Requests post-execution so the completed destination can be returned.
    @Override
    public boolean doPostExecute() {
        return true;
    }

    /// Returns the downloaded or previously validated client JAR.
    ///
    /// @throws IOException if no regular cached JAR is available
    @Override
    public void postExecute() throws IOException {
        @Nullable Path result = getResult();
        //noinspection ConstantValue
        if (result == null || !Files.isRegularFile(result)) {
            throw new IOException("Minecraft client JAR was not downloaded");
        }
    }
}

View on GitHub (pinned to 24702dc5a0)