{"record":{"id":"b828d2941eccea90","repo":"quarkusio/quarkus","slug":"failed-to-derive-the-maven-repository-url-for-regi","errorCode":null,"errorMessage":"Failed to derive the Maven repository URL for registry ${configId}","messagePattern":"Failed to derive the Maven repository URL for registry (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/client/maven/MavenRegistryClientFactory.java","lineNumber":448,"sourceCode":"\n    private List<RemoteRepository> determineRegistryRepos(RegistryConfig config, List<RemoteRepository> configuredRepos) {\n        final RegistryMavenConfig mavenConfig = config.getMaven() == null ? null : config.getMaven();\n        final RegistryMavenRepoConfig repoConfig = mavenConfig == null ? null : mavenConfig.getRepository();\n        final String repoId = repoConfig == null || repoConfig.getId() == null ? config.getId() : repoConfig.getId();\n        String repoUrl = repoConfig == null ? null : repoConfig.getUrl();\n        if (repoUrl == null || repoUrl.isBlank()) {\n            // if the repo URL wasn't configured and there is a repository in the Maven config\n            // whose ID matches the registry ID, this is what we are going to use\n            for (RemoteRepository r : configuredRepos) {\n                if (r.getId().equals(repoId)) {\n                    return Collections.emptyList();\n                }\n            }\n            // derive the repo URL from the registry ID\n            try {\n                repoUrl = new URL(\"https\", config.getId(), \"/maven\").toExternalForm();\n            } catch (MalformedURLException e) {\n                throw new IllegalStateException(\"Failed to derive the Maven repository URL for registry \" + config.getId(), e);\n            }\n        } else {\n            // if the configured registry URL is already present in the Maven config\n            // we are going use it\n            for (RemoteRepository repo : configuredRepos) {\n                if (repo.getUrl().equals(repoUrl)) {\n                    return Collections.emptyList();\n                }\n            }\n        }\n\n        final RemoteRepository.Builder repoBuilder = new RemoteRepository.Builder(repoId, \"default\", repoUrl);\n\n        final String updatePolicy = config.getUpdatePolicy();\n        if (updatePolicy != null) {\n            if (updatePolicy.equalsIgnoreCase(RepositoryPolicy.UPDATE_POLICY_DAILY)\n                    || updatePolicy.equalsIgnoreCase(RepositoryPolicy.UPDATE_POLICY_ALWAYS)\n                    || updatePolicy.equalsIgnoreCase(RepositoryPolicy.UPDATE_POLICY_NEVER)","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/client/maven/MavenRegistryClientFactory.java#L430-L466","documentation":"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.","triggerScenarios":"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.","commonSituations":"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:`.","solutions":["Set an explicit `url:` for the registry in registries.yaml instead of relying on URL derivation","Change the registry id to a bare hostname (e.g. `registry.acme.org`) with no scheme, path, or spaces","Check for invisible whitespace/typos in the configured id"],"exampleFix":"# before\nregistries:\n  - id: https://registry.acme.org\n# after\nregistries:\n  - id: registry.acme.org\n    url: https://registry.acme.org/maven","handlingStrategy":"validation","validationCode":"if (registry.getUrl() == null && (registry.getId() == null || registry.getId().isBlank() || registry.getId().contains(\"://\") || registry.getId().contains(\" \"))) {\n    throw new IllegalArgumentException(\"Registry \" + registry.getId() + \" needs a bare-host id or an explicit url\");\n}","typeGuard":null,"tryCatchPattern":"try { client = factory.buildRegistryClient(cfg); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"Failed to derive the Maven repository URL\")) { setExplicitUrl(cfg); } else throw e; }","preventionTips":["Set explicit url for every custom registry","Never embed a full URL in the registry id","Trim whitespace from ids when generating config"],"tags":["configuration","url","registry"],"backgroundTag":"invalid-url-config","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}