quarkusio/quarkus · error · RegistryResolutionException

Failed to load platform catalog from ${jsonFile}

Error message

Failed to load platform catalog from ${jsonFile}

What it means

Thrown by MavenPlatformsResolver.resolvePlatforms when the resolved platform catalog JSON artifact cannot be read or parsed. The resolver located and downloaded the platform-catalog artifact, then PlatformCatalog.mutableFromFile(jsonFile) failed with an IOException while opening or deserializing the file. The underlying IOException is kept as the cause.

Source

Thrown at independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/client/maven/MavenPlatformsResolver.java:51

    @Override
    public PlatformCatalog.Mutable resolvePlatforms(String quarkusVersion) throws RegistryResolutionException {
        final ArtifactCoords baseCoords = config.getArtifact();
        final Artifact catalogArtifact = new DefaultArtifact(baseCoords.getGroupId(), baseCoords.getArtifactId(),
                quarkusVersion, baseCoords.getType(), baseCoords.getVersion());
        log.debug("Resolving platform catalog %s", catalogArtifact);
        final ArtifactResult artifactResult;
        try {
            artifactResult = artifactResolver.resolveArtifact(catalogArtifact);
        } catch (Exception e) {
            log.debug("Failed to resolve platform catalog %s", catalogArtifact);
            return null;
        }
        final Path jsonFile = artifactResult.getArtifact().getFile().toPath();
        final PlatformCatalog.Mutable catalog;
        try {
            catalog = PlatformCatalog.mutableFromFile(jsonFile);
        } catch (IOException e) {
            throw new RegistryResolutionException(
                    "Failed to load platform catalog from " + jsonFile, e);
        }

        try {
            final Metadata mavenMetadata = artifactResolver.resolveMetadata(artifactResult);
            if (mavenMetadata != null) {
                final String lastUpdated = mavenMetadata.getVersioning() == null ? null
                        : mavenMetadata.getVersioning().getLastUpdated();
                if (lastUpdated != null) {
                    /*
                     * This is how it can be parsed
                     * java.util.TimeZone timezone = java.util.TimeZone.getTimeZone("UTC");
                     * java.text.DateFormat fmt = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
                     * fmt.setTimeZone(timezone);
                     * final Date date = fmt.parse(lastUpdated);
                     */
                    catalog.setMetadata(Constants.LAST_UPDATED, lastUpdated);
                }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Delete the corrupt artifact from the local Maven repository and re-run to force re-download (mvn -U or clear ~/.m2/repository/<platform-catalog-path>).
  2. Inspect the file at the printed jsonFile path with jq to confirm whether it is valid JSON or an error page; fix the repository/mirror if so.
  3. Retry with a fresh local repository (-Dmaven.repo.local=<dir>) to bypass cache corruption.
  4. Align the registry-client/Quarkus version with the platform catalog schema version in use.
  5. Check read permissions on the local repository path.

Example fix

// before: failing against a corrupt cached catalog
quarkus platform list
// after: purge and re-resolve the catalog
rm -rf ~/.m2/repository/io/quarkus/platform && mvn -U quarkus:platform-list
Defensive patterns

Strategy: try-catch

Validate before calling

Path jsonFile = Path.of("...platform-catalog.json");
if (!Files.isRegularFile(jsonFile) || !Files.isReadable(jsonFile)) {
    throw new IllegalStateException("Platform catalog not readable: " + jsonFile);
}
if (Files.size(jsonFile) == 0) {
    throw new IllegalStateException("Platform catalog is empty (corrupt download?): " + jsonFile);
}
// sanity: first non-whitespace char should be '{'
try (var r = Files.newBufferedReader(jsonFile)) {
    int c; while ((c = r.read()) != -1 && Character.isWhitespace(c));
    if (c != '{') throw new IllegalStateException("Not JSON content");
}

Type guard

static boolean looksLikeValidCatalogFile(Path p) {
    try {
        if (!Files.isRegularFile(p) || !Files.isReadable(p) || Files.size(p) == 0) return false;
        try (var r = Files.newBufferedReader(p)) {
            int c; do { c = r.read(); } while (c != -1 && Character.isWhitespace(c));
            return c == '{';
        }
    } catch (IOException e) { return false; }
}

Try / catch

try {
    PlatformCatalog catalog = resolver.resolvePlatforms();
} catch (RegistryResolutionException e) {
    if (e.getMessage().startsWith("Failed to load platform catalog from")) {
        // purge corrupt artifact from local repo and retry once
        purgeFromLocalRepo(e.getMessage().replace("Failed to load platform catalog from ", ""));
        catalog = resolver.resolvePlatforms();
    } else throw e;
}

Prevention

When it happens

Trigger: Calling resolvePlatforms where the platform-catalog artifact exists locally or was fetched but its JSON file is corrupt, truncated, empty, not valid Quarkus platform-catalog JSON, or cannot be opened due to filesystem permissions.

Common situations: Interrupted downloads leaving partial files in ~/.m2/repository; a repository manager serving cached error pages instead of the JSON artifact; a platform catalog generated by a newer/incompatible registry JSON schema; read-only or permission-restricted CI cache volumes.

Related errors


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