quarkusio/quarkus · error · IllegalStateException
No AnonymousIdentityProvider registered. An instance of Anon
Error message
No AnonymousIdentityProvider registered. An instance of AnonymousIdentityProvider must be provided to allow the Anonymous identity to be created.
What it means
Quarkus requires an AnonymousIdentityProvider so unauthenticated requests get an anonymous SecurityIdentity. The Builder refuses to construct the manager if no provider handles AnonymousAuthenticationRequest, since downstream code assumes an anonymous identity is always obtainable.
Source
Thrown at extensions/security/runtime/src/main/java/io/quarkus/security/runtime/QuarkusIdentityProviderManagerImpl.java:242
return this;
}
/**
* @param blockingExecutor The executor to use for blocking tasks
* @return this builder
*/
public Builder setBlockingExecutor(Executor blockingExecutor) {
this.blockingExecutor = createBlockingExecutor(() -> blockingExecutor);
return this;
}
/**
* @return a new {@link QuarkusIdentityProviderManagerImpl}
*/
public QuarkusIdentityProviderManagerImpl build() {
built = true;
if (!providers.containsKey(AnonymousAuthenticationRequest.class)) {
throw new IllegalStateException(
"No AnonymousIdentityProvider registered. An instance of AnonymousIdentityProvider must be provided to allow the Anonymous identity to be created.");
}
for (List<IdentityProvider<?>> providers : providers.values()) {
providers.sort(new Comparator<IdentityProvider<? extends AuthenticationRequest>>() {
@Override
public int compare(IdentityProvider o1, IdentityProvider o2) {
return Integer.compare(o2.priority(), o1.priority());
}
});
}
if (blockingExecutor == null) {
throw new IllegalStateException("no blocking executor specified");
}
augmentors.sort(new Comparator<SecurityIdentityAugmentor>() {
@Override
public int compare(SecurityIdentityAugmentor o1, SecurityIdentityAugmentor o2) {
return Integer.compare(o2.priority(), o1.priority());
}View on GitHub (pinned to e1c734241f)
Solutions
- Add an AnonymousIdentityProvider to the builder: builder.addProvider(new AnonymousIdentityProvider()) before build().
- In production apps rely on the standard Quarkus wiring, which registers it automatically — check for custom build steps that replaced the SecurityIdentityProviderProducer.
- In tests, mirror the production builder configuration.
Example fix
// before
var manager = new Builder()
.addProvider(new MyAuthProvider())
.build();
// after
var manager = new Builder()
.addProvider(new MyAuthProvider())
.addProvider(new AnonymousIdentityProvider())
.build(); Defensive patterns
Strategy: validation
Validate before calling
// before build()
if (!builderHasProvider(AnonymousAuthenticationRequest.class))
builder.addProvider(new AnonymousIdentityProvider());
var m = builder.build(); Prevention
- Always include AnonymousIdentityProvider in manual builds
- Mirror default Quarkus security wiring in tests
- Rely on CDI-produced manager in production
When it happens
Trigger: Constructing QuarkusIdentityProviderManagerImpl manually in tests or custom code without adding an AnonymousIdentityProvider; replacing the default security build with custom wiring that omits the anonymous provider.
Common situations: Unit tests that build the manager with only their own providers; custom SecurityIdentityProvider setup in extensions; removing quarkus-security default configuration accidentally.
Related errors
- No IdentityProviders were registered to handle Authenticatio
- Current principal ${principal} is not a JSON web token
- No producers for required item %s, step builder used: %s
- cycle detection failure report (dynamic CycleBuildException
- You must override this method or IdentityProvider.authentica
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/96a4cfc80c270c51.
Report an issue: GitHub.