{"record":{"id":"fea0d4fb28104887","repo":"quarkusio/quarkus","slug":"serialized-application-file-not-found-or-not-reada","errorCode":null,"errorMessage":"Serialized application file not found or not readable: ${cacheFile}. The application may not have been packaged correctly with aot-jar type.","messagePattern":"Serialized application file not found or not readable: (.+?)\\. The application may not have been packaged correctly with aot-jar type\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/AotQuarkusEntryPoint.java","lineNumber":57,"sourceCode":"        }\n    }\n\n    private static void doRun(String... args) throws Throwable {\n        Path jarPath = QuarkusEntryPoint.resolveJarPath(AotQuarkusEntryPoint.class);\n        if (jarPath == null) {\n            throw new IllegalStateException(\"Unable to determine launch jar path\");\n        }\n        Path appRoot = jarPath.getParent().getParent().getParent();\n\n        // Load cached resources and main class name\n        AotSerializedApplication app;\n        Path cacheFile = appRoot.resolve(QUARKUS_APPLICATION_DAT);\n        if (Files.isReadable(cacheFile)) {\n            try (InputStream in = new BufferedInputStream(Files.newInputStream(cacheFile), 8192)) {\n                app = AotSerializedApplication.read(in);\n            }\n        } else {\n            throw new IllegalStateException(\"Serialized application file not found or not readable: \" + cacheFile\n                    + \". The application may not have been packaged correctly with aot-jar type.\");\n        }\n\n        final AotRunnerClassLoader aotRunnerClassLoader = app.getRunnerClassLoader();\n        try {\n            Thread.currentThread().setContextClassLoader(aotRunnerClassLoader);\n            QuarkusForkJoinWorkerThread.setQuarkusAppClassloader(aotRunnerClassLoader);\n            Class<?> mainClass = aotRunnerClassLoader.loadClass(app.getMainClass());\n            MethodHandles.Lookup lookup = MethodHandles.lookup();\n            lookup.findStatic(mainClass, \"main\", MethodType.methodType(void.class, String[].class)).invokeExact(args);\n        } finally {\n            QuarkusForkJoinWorkerThread.setQuarkusAppClassloader(null);\n        }\n    }\n}\n","sourceCodeStart":39,"sourceCodeEnd":73,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/AotQuarkusEntryPoint.java#L39-L73","documentation":"After locating the app root, AotQuarkusEntryPoint.doRun() loads the serialized application image from QUARKUS_APPLICATION_DAT (quarkus-application.dat). If that file does not exist or is not readable, the packaged application is incomplete — the AOT cache was never written or was excluded — so startup aborts with this IllegalStateException.","triggerScenarios":"Running the AOT entry point when quarkus-application.dat is missing from the appRoot directory, i.e. the jar was not packaged with the aot-jar type or the cache file was deleted/excluded during packaging/deployment.","commonSituations":"Copying only some files from target/quarkus-app, container images that exclude the .dat file, mixing artifacts from a regular fast-jar build with the AOT entry point, or an outdated/incorrect packaging configuration.","solutions":["Rebuild the application with the aot-jar packaging type (mvn clean package) so quarkus-application.dat is generated.","Copy/deploy the full target/quarkus-app directory, including quarkus-application.dat.","Verify the artifact being launched actually corresponds to the aot-jar build, not a fast-jar build."],"exampleFix":"// before (partial copy)\ncp target/quarkus-app/quarkus-run.jar /app/\n\n// after\ncp -r target/quarkus-app/ /app/","handlingStrategy":"validation","validationCode":"Path cache = Paths.get(\"target/quarkus-app/quarkus-application.dat\");\nif (!Files.isReadable(cache)) {\n    throw new IllegalStateException(\"quarkus-application.dat missing; rebuild with aot-jar packaging\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    AotQuarkusEntryPoint.main(args);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Serialized application file not found\")) {\n        System.err.println(\"Repackage with aot-jar type and deploy the full quarkus-app directory\");\n    } else throw e;\n}","preventionTips":["Deploy the entire target/quarkus-app directory, never individual files.","Ensure Docker COPY includes quarkus-application.dat.","Rebuild after any packaging-type change."],"tags":["aot","packaging","missing-file","startup"],"backgroundTag":"cache-file-missing","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}