jenkinsci/jenkins · error · IOException

Failed to expand {}

Error message

Failed to expand {}

What it means

Thrown by explode() when Ant's unzip task raises BuildException while extracting a plugin archive into its exploded directory. Jenkins deletes the old exploded dir first, then unpacks; a build failure means the archive itself could not be read as a valid zip. The cause BuildException is chained.

Source

Thrown at core/src/main/java/hudson/ClassicPluginStrategy.java:484

     * Explodes the plugin into a directory, if necessary.
     */
    private static void explode(File archive, File destDir) throws IOException {
        Util.createDirectories(Util.fileToPath(destDir));

        // timestamp check
        File explodeTime = new File(destDir, ".timestamp2");
        if (explodeTime.exists() && explodeTime.lastModified() == archive.lastModified())
            return; // no need to expand

        // delete the contents so that old files won't interfere with new files
        Util.deleteRecursive(destDir);

        try {
            Project prj = new Project();
            unzipExceptClasses(archive, destDir, prj);
            createClassJarFromWebInfClasses(archive, destDir, prj);
        } catch (BuildException x) {
            throw new IOException("Failed to expand " + archive, x);
        }

        try {
            new FilePath(explodeTime).touch(archive.lastModified());
        } catch (InterruptedException e) {
            throw new AssertionError(e); // impossible
        }
    }

    /**
     * Repackage classes directory into a jar file to make it remoting friendly.
     * The remoting layer can cache jar files but not class files.
     */
    private static void createClassJarFromWebInfClasses(File archive, File destDir, Project prj) throws IOException {
        File classesJar = new File(destDir, "WEB-INF/lib/classes.jar");

        ZipFileSet zfs = new ZipFileSet();
        zfs.setProject(prj);

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. Re-download/reinstall the plugin so the archive is complete and valid.
  2. Verify integrity by opening the .jpi with `jar tf plugin.jpi` or `unzip -t plugin.jpi`.
  3. Check disk space and permissions on the plugins directory.
  4. Delete the exploded directory and the archive, then reinstall fresh.

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

try (JarFile jf = new JarFile(archive)) {
    // throws ZipException if corrupt before explode() is ever called
    jf.stream().count();
}

Type guard

null

Try / catch

try {
    // explode
} catch (IOException e) { // 'Failed to expand'
    // re-download or reject the archive; do not retry the same corrupt file
}

Prevention

When it happens

Trigger: The plugin .jpi/.hpi file is truncated, corrupt, or not a valid zip; disk I/O error mid-extract; archive was partially written by a failed download; unzipExceptClasses or createClassJarFromWebInfClasses hits a malformed central directory.

Common situations: Plugin downloaded over a flaky connection and saved incomplete; disk filled during write; antivirus quarantined part of the archive; manual copy of a .jpi that was still being written.

Related errors


AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14). Data as JSON: /api/errors/3215c749ad9fe74c. Report an issue: GitHub.