{"record":{"id":"06d3d43acb43950e","repo":"quarkusio/quarkus","slug":"failed-to-deserialize-quarkus-model","errorCode":null,"errorMessage":"Failed to deserialize quarkus model","messagePattern":"Failed to deserialize quarkus model","errorType":"exception","errorClass":"AppModelResolverException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/BootstrapUtils.java","lineNumber":108,"sourceCode":"    public static Path serializeQuarkusModel(ApplicationModel model) throws IOException {\n        final Path serializedModel = File.createTempFile(\"quarkus-model\", \".dat\").toPath();\n        serializeAppModel(model, serializedModel);\n        return serializedModel;\n    }\n\n    /**\n     * @deprecated for removal since 3.31.0 in favor of ApplicationModelSerializer methods\n     */\n    @Deprecated(forRemoval = true)\n    public static ApplicationModel deserializeQuarkusModel(Path modelPath) throws AppModelResolverException {\n        if (Files.exists(modelPath)) {\n            try (InputStream existing = Files.newInputStream(modelPath);\n                    ObjectInputStream object = new ObjectInputStream(existing)) {\n                ApplicationModel model = (ApplicationModel) object.readObject();\n                IoUtils.recursiveDelete(modelPath);\n                return model;\n            } catch (IOException | ClassNotFoundException e) {\n                throw new AppModelResolverException(\"Failed to deserialize quarkus model\", e);\n            }\n        }\n        throw new AppModelResolverException(\"Unable to locate quarkus model\");\n    }\n\n    /**\n     * Returns a location where a serialized {@link ApplicationModel} would be found for dev mode.\n     *\n     * @param projectBuildDir project build directory\n     * @return file of a serialized application model for dev mode\n     */\n    public static Path resolveSerializedAppModelPath(Path projectBuildDir) {\n        return getBootstrapBuildDir(projectBuildDir).resolve(\"dev-app-model.dat\");\n    }\n\n    /**\n     * Returns a location where a serialized {@link ApplicationModel} would be found for test mode.\n     *","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/BootstrapUtils.java#L90-L126","documentation":"BootstrapUtils.deserializeQuarkusModel() reads a previously serialized ApplicationModel from disk (used as a dev-mode cache). If reading fails — corrupt/truncated cache file, an incompatibly serialized class after a Quarkus version change (ClassNotFoundException), or an I/O error — it wraps the failure in AppModelResolverException with this message. The cached model is deleted afterwards so a fresh resolution can occur on retry.","triggerScenarios":"Loading a dev-mode cached application model from a modelPath whose file was written by a different Quarkus version (readObject throws ClassNotFoundException) or is corrupt (IOException).","commonSituations":"Upgrading Quarkus (or a dependency of ApplicationModel classes) without cleaning target/; killed build leaving a truncated cache; copying build output between machines/JDKs.","solutions":["Delete the cached model file / run a clean build so the model is re-resolved from scratch","Re-resolve the application model instead of relying on the cache","If it recurs after version upgrades, ensure all Quarkus artifacts are the same version"],"exampleFix":"// after a Quarkus upgrade\nmvn clean quarkus:dev\n// or delete the stale cache manually\nrm target/quarkus-bootstrap/app-model.dat","handlingStrategy":"fallback","validationCode":"Path modelPath = BootstrapUtils.getSerializedModelLocation(buildDir);\nboolean cacheUsable = Files.exists(modelPath)\n    && Files.getLastModifiedTime(modelPath).toMillis() > lastCleanTime;\n// if !cacheUsable, resolve the model fresh instead of deserializing","typeGuard":null,"tryCatchPattern":"try {\n    model = BootstrapUtils.deserializeQuarkusModel(modelPath);\n} catch (AppModelResolverException e) {\n    log.debugf(\"Cache unusable (%s), re-resolving\", e.getMessage());\n    model = resolver.resolveModel(workspace);\n}","preventionTips":["Run mvn clean (or delete target/) after upgrading Quarkus","Treat the serialized model purely as a cache and always keep a re-resolve fallback path","Never copy target/ output across different Quarkus versions or JDKs"],"tags":["cache","deserialization","dev-mode"],"backgroundTag":"cache-deserialization-failed","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"}