quarkusio/quarkus · error · AppModelResolverException

Unable to locate quarkus model

Error message

Unable to locate quarkus model

What it means

deserializeQuarkusModel() expects a serialized ApplicationModel file at the given modelPath; if the file does not exist at all, it throws AppModelResolverException with this message. This is a missing-cache condition: nothing was serialized (or the file was removed) before deserialization was attempted.

Source

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

        return serializedModel;
    }

    /**
     * @deprecated for removal since 3.31.0 in favor of ApplicationModelSerializer methods
     */
    @Deprecated(forRemoval = true)
    public static ApplicationModel deserializeQuarkusModel(Path modelPath) throws AppModelResolverException {
        if (Files.exists(modelPath)) {
            try (InputStream existing = Files.newInputStream(modelPath);
                    ObjectInputStream object = new ObjectInputStream(existing)) {
                ApplicationModel model = (ApplicationModel) object.readObject();
                IoUtils.recursiveDelete(modelPath);
                return model;
            } catch (IOException | ClassNotFoundException e) {
                throw new AppModelResolverException("Failed to deserialize quarkus model", e);
            }
        }
        throw new AppModelResolverException("Unable to locate quarkus model");
    }

    /**
     * Returns a location where a serialized {@link ApplicationModel} would be found for dev mode.
     *
     * @param projectBuildDir project build directory
     * @return file of a serialized application model for dev mode
     */
    public static Path resolveSerializedAppModelPath(Path projectBuildDir) {
        return getBootstrapBuildDir(projectBuildDir).resolve("dev-app-model.dat");
    }

    /**
     * Returns a location where a serialized {@link ApplicationModel} would be found for test mode.
     *
     * @param projectBuildDir project build directory
     * @return file of a serialized application model for test mode
     */

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the application model was serialized first (complete the bootstrap/serialization phase before deserializing)
  2. Check that the path comes from BootstrapUtils.getSerializedModelLocation() or equivalent canonical location and points to the same build dir
  3. Re-run the build/dev mode so the model file is regenerated

Example fix

// before
Path modelPath = Path.of(projectBuildDir, "my-model.dat");
ApplicationModel m = BootstrapUtils.deserializeQuarkusModel(modelPath);
// after
Path modelPath = BootstrapUtils.getSerializedModelLocation(projectBuildDir);
if (Files.exists(modelPath)) {
    ApplicationModel m = BootstrapUtils.deserializeQuarkusModel(modelPath);
}
Defensive patterns

Strategy: try-catch

Validate before calling

Path modelPath = BootstrapUtils.getSerializedModelLocation(projectBuildDir);
if (!Files.exists(modelPath)) {
    // resolve fresh instead of deserializing
    return resolver.resolveModel(workspace);
}

Try / catch

try {
    model = BootstrapUtils.deserializeQuarkusModel(modelPath);
} catch (AppModelResolverException e) {
    if (e.getMessage().contains("Unable to locate")) {
        model = resolver.resolveModel(workspace);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling deserializeQuarkusModel() with a modelPath that was never written, after the serialized model file was deleted, or pointing at the wrong build directory path.

Common situations: Race between two dev-mode processes where one deletes the file; custom tooling computing the model location differently than getSerializedModelLocation(); first run before any successful serialization.

Related errors


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