quarkusio/quarkus · error · IllegalStateException

Failed to locate the repository URL corresponding to reposit

Error message

Failed to locate the repository URL corresponding to repository ${srcRepoId}

What it means

After successfully resolving the registry descriptor, buildRegistryClient() tries to determine which remote repository served it by matching result.getRepository().getId() against the resolver's configured repositories to obtain the source URL. If the artifact came from a repository whose id is not present in the resolver's repository list, this IllegalStateException is thrown — an internal consistency failure indicating the resolver configuration and artifact result disagree.

Source

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

                        registryDescriptorCoords, cleanupTimestampedArtifacts);
            } catch (BootstrapMavenException e) {
                throw new RegistryResolutionException(getDescriptorResolutionFailureMessage(config, resolver, e));
            }
        }

        final String srcRepoId = result.getRepository() == null ? "n/a" : result.getRepository().getId();
        log.debug("Resolved registry descriptor %s from %s", registryDescriptorCoords, srcRepoId);
        if (!registryRepos.isEmpty()) {
            if (srcRepoId != null && !"local".equals(srcRepoId)) {
                String srcRepoUrl = null;
                for (RemoteRepository repo : resolver.getRepositories()) {
                    if (repo.getId().equals(srcRepoId)) {
                        srcRepoUrl = repo.getUrl();
                        break;
                    }
                }
                if (srcRepoUrl == null) {
                    throw new IllegalStateException(
                            "Failed to locate the repository URL corresponding to repository " + srcRepoId);
                }
            } else {
                log.debug("Failed to determine the remote repository for %s registry descriptor %s", config.getId(),
                        registryDescriptorCoords);
            }
        }

        final RegistryConfig.Mutable descriptor;
        try {
            // Do not fix or add any missing bits.
            descriptor = RegistryConfig.mutableFromFile(result.getArtifact().getFile().toPath());
        } catch (IOException e) {
            throw new IllegalStateException("Failed to deserialize registries descriptor " + result.getArtifact().getFile(), e);
        }

        if (!isComplete(config, descriptor)) {
            config = completeRegistryConfig(config, descriptor);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect settings.xml mirrors/profiles and make the effective repository id match the configured registry repo id (align <mirror><id> or remove the renaming mirror)
  2. Run with -X / debug logging to see which repository id the artifact was actually resolved from and compare with the configured list
  3. Update the Quarkus registry-client/Maven resolver versions — this can be an internal inconsistency bug fixed upstream
  4. As a workaround, define the registry repository explicitly (matching id and url) in settings.xml so the id lookup succeeds

Example fix

// before: mirror id differs from the registry repo id
<mirror><id>my-corp-mirror</id><mirrorOf>quarkus-registry</mirrorOf>...
// after: keep the same id so lookup matches
<mirror><id>quarkus-registry</id><url>https://corp-mirror.example/quarkus</url><mirrorOf>quarkus-registry</mirrorOf>...</mirror>
Defensive patterns

Strategy: validation

Validate before calling

// before building the client, ensure repository ids are unique and mirrors keep ids stable
Set<String> ids = new HashSet<>();
for (RemoteRepository r : originalResolver.getRepositories()) {
    if (!ids.add(r.getId())) throw new IllegalStateException("Duplicate repo id: " + r.getId());
}

Prevention

When it happens

Trigger: The resolved descriptor's ArtifactResult reports a source repository id (not "local"/null) that does not match any RemoteRepository id in the resolver's effective repository list — e.g. resolution was served by a repository injected via a mirror with a rewritten id, or resolver/repo lists were customized inconsistently.

Common situations: Maven mirror settings rewriting repository ids so the effective repo id differs from the configured one; custom MavenRepositoryService/resolver wrappers that drop or rename repos; unusual settings.xml configurations mixing profiles with same-id repos; a Quarkus/Maven resolver version mismatch bug.

Related errors


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