quarkusio/quarkus · error · IllegalStateException
Error unzipping import file %s: %s
Error message
Error unzipping import file %s: %s
What it means
SchemaToolingUtil.unzipZipFilesAndReplaceZips processes SQL import files referenced by Hibernate schema generation/data loading. When a referenced import file is a ZIP archive and extracting it fails (bad zip, IO error), this IllegalStateException wraps the underlying message with the offending file name.
Source
Thrown at extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/SchemaToolingUtil.java:51
String[] fileNames = commaSeparatedFileNames.split(",");
for (String fileName : fileNames) {
if (fileName.endsWith(".zip")) {
try {
Path unzipDir = Files.createTempDirectory(SQL_LOAD_SCRIPT_UNZIPPED_DIR_PREFIX);
unzipDirs.add(unzipDir);
URL resource = Thread.currentThread()
.getContextClassLoader()
.getResource(fileName);
Path zipFile = Paths.get(resource.toURI());
ZipUtils.unzip(zipFile, unzipDir);
try (DirectoryStream<Path> paths = Files.newDirectoryStream(unzipDir)) {
for (Path path : paths) {
unzippedFilesNames.add(path.toAbsolutePath().toString());
}
}
} catch (Exception e) {
throw new IllegalStateException(String.format(Locale.ROOT, "Error unzipping import file %s: %s",
fileName, e.getMessage()), e);
}
} else {
unzippedFilesNames.add(fileName);
}
}
return new PreparedImportScripts(String.join(",", unzippedFilesNames), unzipDirs);
} else {
return new PreparedImportScripts(null, Collections.emptyList());
}
} catch (RuntimeException e) {
failure = e;
throw e;
} finally {
if (failure != null) {
for (Path unzipDir : unzipDirs) {
recursiveDeleteQuietly(unzipDir);
}View on GitHub (pinned to e1c734241f)
Solutions
- Open the referenced zip manually and verify it extracts correctly (unzip -t file.zip); regenerate it if corrupt.
- Point the import-file config at the plain .sql file(s) instead of a zip.
- Check file permissions and that the path resolves at runtime (inside the jar/container).
- If it's not a zip, remove the extension so the file is treated as a normal import script.
Example fix
// before quarkus.hibernate-orm.database.generation.create-sourcename=scripts/import.zip // after quarkus.hibernate-orm.database.generation.create-sourcename=sql/import.sql
Defensive patterns
Strategy: validation
Validate before calling
// Validate the import zip before configuring schema generation
Path zip = Path.of("scripts/import.zip");
if (!Files.isRegularFile(zip) || Files.size(zip) == 0) throw new IllegalStateException("bad zip");
try (ZipFile zf = new ZipFile(zip.toFile())) {
if (!zf.entries().hasMoreElements()) throw new IllegalStateException("empty zip");
} Prevention
- Commit plain .sql scripts instead of zips for import files
- Verify archives with unzip -t in CI before container build
- Check resource visibility inside the packaged jar/container
When it happens
Trigger: quarkus.hibernate-orm.database.generation.create-sourcename (or .load-sourcename) points to a .zip that is corrupt, empty, password-protected, or unreadable; filesystem permission errors on the unzip target directory; the file was renamed but is not actually a zip.
Common situations: CI pipelines mounting truncated artifacts; devs committing placeholder .zip files; Docker images missing the referenced resource; Windows/Unix path mismatches making the archive unreadable.
Related errors
- This isn't used for schema generation - see SessionFactoryOb
- Failed to read
- Failed to read
- Failed to read <jar>
- Failed to locate <name> in <zip>
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/5c066c18ddd73f11.
Report an issue: GitHub.