quarkusio/quarkus · error · IOException

Cached artifact does not exist: ${p}

Error message

Cached artifact does not exist: ${p}

What it means

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.

Source

Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/BootstrapUtils.java:192

     *
     * @param file serialized application model file
     * @param workspaceId expected workspace ID
     * @return deserialized application model
     * @throws ClassNotFoundException in case a required class could not be loaded
     * @throws IOException in case of an IO failure
     */
    @Deprecated(forRemoval = true)
    public static ApplicationModel readAppModelWithWorkspaceId(Path file, int workspaceId)
            throws ClassNotFoundException, IOException {
        try (ObjectInputStream reader = new ObjectInputStream(Files.newInputStream(file))) {
            if (reader.readInt() == CP_CACHE_FORMAT_ID) {
                if (reader.readInt() == workspaceId) {
                    final ApplicationModel appModel = (ApplicationModel) reader.readObject();
                    log.debugf("Loaded application model %s from %s", appModel, file);
                    for (ResolvedDependency d : appModel.getDependencies(DependencyFlags.DEPLOYMENT_CP)) {
                        for (Path p : d.getResolvedPaths()) {
                            if (!Files.exists(p)) {
                                throw new IOException("Cached artifact does not exist: " + p);
                            }
                        }
                    }
                    return appModel;
                } else {
                    log.debugf("Application model saved in %s has a different workspace ID", file);
                }
            } else {
                log.debugf("Unsupported application model serialization format in %s", file);
            }
        }
        return null;
    }

    /**
     * Generates a comma-separated list of flag names for an integer representation of the flags.
     *
     * @param flags flags as an integer value

View on GitHub (pinned to e1c734241f)

Solutions

  1. Invalidate the cache and re-resolve the application model so paths are recomputed
  2. Restore the missing artifacts (re-run the build or mvn install for the missing module)
  3. Check local-repo cleanup jobs that delete JARs while caches referencing them remain

Example fix

// handle invalid cache
try {
    return BootstrapUtils.readAppModelWithWorkspaceId(file, expectedId);
} catch (IOException e) {
    // cached artifact missing — re-resolve from repositories
    return resolver.resolveModel(workspace);
}
Defensive patterns

Strategy: retry

Validate before calling

boolean allPathsExist(ApplicationModel m) {
    return m.getDependencies(DependencyFlags.DEPLOYMENT_CP).stream()
        .flatMap(d -> d.getResolvedPaths().stream())
        .allMatch(Files::exists);
}

Try / catch

try {
    model = BootstrapUtils.readAppModelWithWorkspaceId(file, workspaceId);
} catch (IOException e) {
    log.debugf("Cached model invalid (%s), re-resolving", e.getMessage());
    model = resolver.resolveModel(workspace);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/f16159590723509e. Report an issue: GitHub.