quarkusio/quarkus · error · IllegalStateException

Failed to derive the Maven repository URL for registry ${con

Error message

Failed to derive the Maven repository URL for registry ${configId}

What it means

Thrown when no explicit repository URL is configured for a registry and deriving one from the registry ID as `https://<id>/maven` fails because the ID is not a valid URL host (MalformedURLException). The factory needs a concrete repo URL to resolve registry artifacts.

Source

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

    private List<RemoteRepository> determineRegistryRepos(RegistryConfig config, List<RemoteRepository> configuredRepos) {
        final RegistryMavenConfig mavenConfig = config.getMaven() == null ? null : config.getMaven();
        final RegistryMavenRepoConfig repoConfig = mavenConfig == null ? null : mavenConfig.getRepository();
        final String repoId = repoConfig == null || repoConfig.getId() == null ? config.getId() : repoConfig.getId();
        String repoUrl = repoConfig == null ? null : repoConfig.getUrl();
        if (repoUrl == null || repoUrl.isBlank()) {
            // if the repo URL wasn't configured and there is a repository in the Maven config
            // whose ID matches the registry ID, this is what we are going to use
            for (RemoteRepository r : configuredRepos) {
                if (r.getId().equals(repoId)) {
                    return Collections.emptyList();
                }
            }
            // derive the repo URL from the registry ID
            try {
                repoUrl = new URL("https", config.getId(), "/maven").toExternalForm();
            } catch (MalformedURLException e) {
                throw new IllegalStateException("Failed to derive the Maven repository URL for registry " + config.getId(), e);
            }
        } else {
            // if the configured registry URL is already present in the Maven config
            // we are going use it
            for (RemoteRepository repo : configuredRepos) {
                if (repo.getUrl().equals(repoUrl)) {
                    return Collections.emptyList();
                }
            }
        }

        final RemoteRepository.Builder repoBuilder = new RemoteRepository.Builder(repoId, "default", repoUrl);

        final String updatePolicy = config.getUpdatePolicy();
        if (updatePolicy != null) {
            if (updatePolicy.equalsIgnoreCase(RepositoryPolicy.UPDATE_POLICY_DAILY)
                    || updatePolicy.equalsIgnoreCase(RepositoryPolicy.UPDATE_POLICY_ALWAYS)
                    || updatePolicy.equalsIgnoreCase(RepositoryPolicy.UPDATE_POLICY_NEVER)

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set an explicit `url:` for the registry in registries.yaml instead of relying on URL derivation
  2. Change the registry id to a bare hostname (e.g. `registry.acme.org`) with no scheme, path, or spaces
  3. Check for invisible whitespace/typos in the configured id

Example fix

# before
registries:
  - id: https://registry.acme.org
# after
registries:
  - id: registry.acme.org
    url: https://registry.acme.org/maven
Defensive patterns

Strategy: validation

Validate before calling

if (registry.getUrl() == null && (registry.getId() == null || registry.getId().isBlank() || registry.getId().contains("://") || registry.getId().contains(" "))) {
    throw new IllegalArgumentException("Registry " + registry.getId() + " needs a bare-host id or an explicit url");
}

Try / catch

try { client = factory.buildRegistryClient(cfg); } catch (IllegalStateException e) { if (e.getMessage().startsWith("Failed to derive the Maven repository URL")) { setExplicitUrl(cfg); } else throw e; }

Prevention

When it happens

Trigger: determineRegistryRepos (via registryRepos) with a RegistryConfig whose URL is null and whose id (used as an HTTPS host) is malformed — e.g. contains a scheme, port with bad characters, spaces, or is empty.

Common situations: Setting registry id to a full URL like `https://registry.acme.org` instead of just the host; typos or whitespace in the id; using an internal name as id while forgetting to set `url:`.

Related errors


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