Skip to content

fix: extract Classic server zip after download completes#239

Closed
bouclem wants to merge 2 commits into
MCPHackers:mainfrom
bouclem:fix/classic-server-extract-timing
Closed

fix: extract Classic server zip after download completes#239
bouclem wants to merge 2 commits into
MCPHackers:mainfrom
bouclem:fix/classic-server-extract-timing

Conversation

@bouclem
Copy link
Copy Markdown

@bouclem bouclem commented May 25, 2026

Fixes #221

Problem

When setting up a Classic server version, DownloadData's constructor calls FileUtil.extractByExtension(...) on minecraft_server.zip immediately after queueDownload(...). But queueDownload only adds the entry to a queue - the actual download happens later, when performDownload(...) is called from TaskSetup / TaskUpdateLibraries.

So the extraction runs against a file that does not exist yet and throws NoSuchFileException. The exception is swallowed by printStackTrace, the constructor finishes, the zip later gets downloaded, but nothing ever extracts it. The user has to run cleanup and re-setup to get a working server.

Fix

  • Stash the zip path and target jar path on the instance when a .zip server artifact is detected.
  • Move the extractByExtension + Files.move step to run at the end of performDownload(...), after the zip has actually been written to disk.
  • Drop the silent printStackTrace; the IOException now propagates like every other error in performDownload.

Behavior for non-Classic versions (where serverArtifact.url does not end with .zip) is unchanged.

Testing

  • gradlew compileJava - clean build, no new warnings.

Extraction was attempted in the constructor right after only queueing the download, so the zip didn't exist yet on disk and a NoSuchFileException was thrown and silently swallowed. Move the extract step to run at the end of performDownload, once the zip has actually been written.

Fixes MCPHackers#221
@bouclem bouclem force-pushed the fix/classic-server-extract-timing branch from 623eaae to f210471 Compare May 26, 2026 20:00
@bouclem bouclem force-pushed the fix/classic-server-extract-timing branch from f210471 to 9b860b4 Compare May 26, 2026 20:10
@bouclem bouclem closed this May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RetroMCP throws error when downloading Classic server versions

1 participant