{"record":{"id":"5c066c18ddd73f11","repo":"quarkusio/quarkus","slug":"error-unzipping-import-file-s-s","errorCode":null,"errorMessage":"Error unzipping import file %s: %s","messagePattern":"Error unzipping import file (.+?): (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/SchemaToolingUtil.java","lineNumber":51,"sourceCode":"                String[] fileNames = commaSeparatedFileNames.split(\",\");\n                for (String fileName : fileNames) {\n                    if (fileName.endsWith(\".zip\")) {\n                        try {\n                            Path unzipDir = Files.createTempDirectory(SQL_LOAD_SCRIPT_UNZIPPED_DIR_PREFIX);\n                            unzipDirs.add(unzipDir);\n\n                            URL resource = Thread.currentThread()\n                                    .getContextClassLoader()\n                                    .getResource(fileName);\n                            Path zipFile = Paths.get(resource.toURI());\n                            ZipUtils.unzip(zipFile, unzipDir);\n                            try (DirectoryStream<Path> paths = Files.newDirectoryStream(unzipDir)) {\n                                for (Path path : paths) {\n                                    unzippedFilesNames.add(path.toAbsolutePath().toString());\n                                }\n                            }\n                        } catch (Exception e) {\n                            throw new IllegalStateException(String.format(Locale.ROOT, \"Error unzipping import file %s: %s\",\n                                    fileName, e.getMessage()), e);\n                        }\n                    } else {\n                        unzippedFilesNames.add(fileName);\n                    }\n                }\n                return new PreparedImportScripts(String.join(\",\", unzippedFilesNames), unzipDirs);\n            } else {\n                return new PreparedImportScripts(null, Collections.emptyList());\n            }\n        } catch (RuntimeException e) {\n            failure = e;\n            throw e;\n        } finally {\n            if (failure != null) {\n                for (Path unzipDir : unzipDirs) {\n                    recursiveDeleteQuietly(unzipDir);\n                }","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/SchemaToolingUtil.java#L33-L69","documentation":"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.","triggerScenarios":"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.","commonSituations":"CI pipelines mounting truncated artifacts; devs committing placeholder .zip files; Docker images missing the referenced resource; Windows/Unix path mismatches making the archive unreadable.","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."],"exampleFix":"// before\nquarkus.hibernate-orm.database.generation.create-sourcename=scripts/import.zip\n// after\nquarkus.hibernate-orm.database.generation.create-sourcename=sql/import.sql","handlingStrategy":"validation","validationCode":"// Validate the import zip before configuring schema generation\nPath zip = Path.of(\"scripts/import.zip\");\nif (!Files.isRegularFile(zip) || Files.size(zip) == 0) throw new IllegalStateException(\"bad zip\");\ntry (ZipFile zf = new ZipFile(zip.toFile())) {\n    if (!zf.entries().hasMoreElements()) throw new IllegalStateException(\"empty zip\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["schema-generation","import-files","zip","io","hibernate-orm"],"backgroundTag":"import-file-unzip-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}