quarkusio/quarkus · error · IllegalStateException

Unrecognized update policy '${updatePolicy}' for repository

Error message

Unrecognized update policy '${updatePolicy}' for repository ${repoId}

What it means

Thrown when a registry repository's configured update policy is not one of the recognized Maven policies: daily, always, never, or interval:<minutes>. The policy string is passed verbatim into a RepositoryPolicy, so an invalid value is rejected before resolution starts.

Source

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

            // 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)
                    || updatePolicy.startsWith(RepositoryPolicy.UPDATE_POLICY_INTERVAL)) {
                repoBuilder.setPolicy(new RepositoryPolicy(true, updatePolicy, RepositoryPolicy.CHECKSUM_POLICY_WARN));
            } else {
                throw new IllegalStateException("Unrecognized update policy '" + updatePolicy + "' for repository " + repoId);
            }
        }

        return List.of(repoBuilder.build());
    }

    private static String getDescriptorResolutionFailureFromMirrorMessage(RegistryConfig config,
            MavenArtifactResolver resolver, BootstrapMavenException e, List<RemoteRepository> originalRegistryRepos) {
        final StringBuilder buf = new StringBuilder();
        buf.append(getDescriptorResolutionFailureMessage(config, resolver, e));
        buf.append(" having applied the mirrors and/or proxies from the Maven settings to ");
        appendRepoInfo(buf, originalRegistryRepos.get(0));
        for (int i = 1; i < originalRegistryRepos.size(); ++i) {
            buf.append(", ");
            appendRepoInfo(buf, originalRegistryRepos.get(i));
        }
        buf.append(". Re-trying with the original ").append(config.getId()).append(" repository configuration.");
        return buf.toString();

View on GitHub (pinned to e1c734241f)

Solutions

  1. Change the update policy to one of `daily`, `always`, `never`, or `interval:<minutes>` (e.g. `interval:60`)
  2. Remove the updatePolicy line entirely to use the default (daily)
  3. Check for typos and that the interval form uses the `interval:` prefix followed by an integer

Example fix

# before
update-policy: weekly
# after
update-policy: interval:120
Defensive patterns

Strategy: validation

Validate before calling

String p = registry.getUpdatePolicy();
if (p != null && !p.equalsIgnoreCase("daily") && !p.equalsIgnoreCase("always") && !p.equalsIgnoreCase("never") && !p.startsWith("interval")) {
    throw new IllegalArgumentException("Invalid update policy " + p + "; use daily|always|never|interval:<minutes>");
}

Try / catch

try { client = factory.buildRegistryClient(cfg); } catch (IllegalStateException e) { if (e.getMessage().startsWith("Unrecognized update policy")) { fixUpdatePolicy(cfg); } else throw e; }

Prevention

When it happens

Trigger: determineRegistryRepos (via registryRepos) building a RemoteRepository for a registry whose config sets an updatePolicy string that fails equalsIgnoreCase checks against DAILY/ALWAYS/NEVER and does not start with 'interval:'.

Common situations: Typo like `dailyly` or `day`; capitalization variants are fine (case-insensitive) but `weekly`/`monthly` are NOT valid Maven policies; copying npm-style `intervals` wording.

Related errors


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