{"record":{"id":"f16159590723509e","repo":"quarkusio/quarkus","slug":"cached-artifact-does-not-exist-p","errorCode":null,"errorMessage":"Cached artifact does not exist: ${p}","messagePattern":"Cached artifact does not exist: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/BootstrapUtils.java","lineNumber":192,"sourceCode":"     *\n     * @param file serialized application model file\n     * @param workspaceId expected workspace ID\n     * @return deserialized application model\n     * @throws ClassNotFoundException in case a required class could not be loaded\n     * @throws IOException in case of an IO failure\n     */\n    @Deprecated(forRemoval = true)\n    public static ApplicationModel readAppModelWithWorkspaceId(Path file, int workspaceId)\n            throws ClassNotFoundException, IOException {\n        try (ObjectInputStream reader = new ObjectInputStream(Files.newInputStream(file))) {\n            if (reader.readInt() == CP_CACHE_FORMAT_ID) {\n                if (reader.readInt() == workspaceId) {\n                    final ApplicationModel appModel = (ApplicationModel) reader.readObject();\n                    log.debugf(\"Loaded application model %s from %s\", appModel, file);\n                    for (ResolvedDependency d : appModel.getDependencies(DependencyFlags.DEPLOYMENT_CP)) {\n                        for (Path p : d.getResolvedPaths()) {\n                            if (!Files.exists(p)) {\n                                throw new IOException(\"Cached artifact does not exist: \" + p);\n                            }\n                        }\n                    }\n                    return appModel;\n                } else {\n                    log.debugf(\"Application model saved in %s has a different workspace ID\", file);\n                }\n            } else {\n                log.debugf(\"Unsupported application model serialization format in %s\", file);\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Generates a comma-separated list of flag names for an integer representation of the flags.\n     *\n     * @param flags flags as an integer value","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/BootstrapUtils.java#L174-L210","documentation":"readAppModelWithWorkspaceId() loads a cached ApplicationModel and validates that every artifact on the deployment classpath still exists on disk. If a ResolvedDependency's resolved path (a JAR in the local repo or build output) is missing, it throws an IOException with this message, invalidating the cache so the caller falls back to re-resolving. This guards against caches referencing artifacts purged from the repository.","triggerScenarios":"Loading a cached app model whose deployment dependencies point at JARs deleted from the local Maven repository or cleaned target directories since the cache was written.","commonSituations":"A CI job or cleanup script (e.g. mvn dependency:purge-local-repository, rm -rf ~/.m2/repository entries) removed artifacts while the cached model persisted; switching machines with a copied cache; reindexing/snapshot cleanup deleting SNAPSHOT jars.","solutions":["Invalidate the cache and re-resolve the application model so paths are recomputed","Restore the missing artifacts (re-run the build or mvn install for the missing module)","Check local-repo cleanup jobs that delete JARs while caches referencing them remain"],"exampleFix":"// handle invalid cache\ntry {\n    return BootstrapUtils.readAppModelWithWorkspaceId(file, expectedId);\n} catch (IOException e) {\n    // cached artifact missing — re-resolve from repositories\n    return resolver.resolveModel(workspace);\n}","handlingStrategy":"retry","validationCode":"boolean allPathsExist(ApplicationModel m) {\n    return m.getDependencies(DependencyFlags.DEPLOYMENT_CP).stream()\n        .flatMap(d -> d.getResolvedPaths().stream())\n        .allMatch(Files::exists);\n}","typeGuard":null,"tryCatchPattern":"try {\n    model = BootstrapUtils.readAppModelWithWorkspaceId(file, workspaceId);\n} catch (IOException e) {\n    log.debugf(\"Cached model invalid (%s), re-resolving\", e.getMessage());\n    model = resolver.resolveModel(workspace);\n}","preventionTips":["Invalidate/rebuild the cache whenever the local repository is purged","Avoid running local-repo cleanup concurrently with dev mode","Catch IOException from the cache reader and always fall back to full resolution"],"tags":["cache","missing-artifact","maven"],"backgroundTag":"cached-artifact-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"}