If you run a Minecraft server, you might have come across cryptic errors such as “zip file closed” from various plugins, mods, or even the server itself. The error will often show up as
java.lang.IllegalStateException: zip file closed. These errors can be caused by many different problems, most of which can easily be resolved. It’s also important to note that if a specific plugin or mod is mentioned in the error, it does not mean that plugin or mod is the problem.
The most common cause of errors like this is replacing jar files while the server is running. These can be jar files of plugins, mods, or even the server itself, all can cause this error. If this is what has caused the error, the fix is simple. Just restart your server, and in the future only replace jar files while the server has shut down. Given the way Java works, it can sometimes need to load code from jar files while the server is running. If a jar file is swapped out, suddenly the code that it is loading might not match up what it has loaded before, causing unexpected behaviour and errors. Another way this can happen is if the jar file has actually been removed. Either by the file changing name, being deleted, getting moved, or the physical device being unplugged. This also includes running a server within a cloud-synced folder, such as OneDrive or Dropbox, as they often change files as they’re used.
In some cases, a plugin failing to load can cause this error to happen for other plugins that access the failing plugin. To fix this, check your logs to see if any plugins are not loading, and ask the developers of those plugins for help.
Bukkit-based servers such as Paper include a
/reload command, which is known to cause issues. While there are many more devastating issues that command can cause, one possible issue is the “zip file closed” error. To resolve this, restart your server and don’t use
/reload, or plugins such as PlugMan to reload plugins.
Many servers are now running modified forks of the popular server software Paper, however some of these can contain large numbers of bugs and other issues. Some of these forks make buggy changes in a component known as a classloader, which is what Bukkit-based servers use to load plugins. A straightforward way to tell if this is your issue is to switch to Paper and see if that resolves the issue. If it does, issue solved.
Worst case, it’s also possible you’ve either hit a Java bug, or a bug in the distribution of Java that you have downloaded. Many different companies package their own releases of Java, some of which can have modifications that will affect running a Minecraft server. A known working distribution of Java is AdoptOpenJDK. Other gotchas to look out for with Java distributions is making sure that they aren’t headless, and that you’re running the latest version compatible with your release of Minecraft.
If it’s still an issue, it’s time to start narrowing down any plugins or mods you have until the issue is resolved. There are many ways to do this, some are outlined in this post. From here, your best bet is to ask for support from the developers of the server software you’re using. Be it Paper, Forge, Fabric, or something else. It’s possible they’ve got a bug, or something else less common is going on.
The zip file closed error can be hard to pin down, as it nearly never tells you what’s causing it. Luckily in most cases the fix is simple. Be it no longer doing harmful things, or switching server software, almost all cases can easily be solved.
This article is part of a series on how to run a Minecraft server. Click here to find out more