quarkusio/quarkus · error · IllegalStateException
Registered OIDC Client is closed
Error message
Registered OIDC Client is closed
What it means
Once a RegisteredClientImpl is closed (closed=true, via its close/delete lifecycle), all further API calls are rejected with IllegalStateException. checkClosed() is invoked by metadata(), read(), update(), and delete(), so any use of a closed client instance throws. This prevents requests on a client whose registration resources may have been released.
Source
Thrown at extensions/oidc-client-registration/runtime/src/main/java/io/quarkus/oidc/client/registration/runtime/RegisteredClientImpl.java:222
}
private Uni<Void> deleteResponse(HttpResponse<Buffer> resp, OidcRequestContextProperties requestProps) {
return OidcCommonUtils.filterHttpResponse(requestProps, resp, responseFilters, OidcEndpoint.Type.REGISTERED_CLIENT)
.invoke(buffer -> {
if (resp.statusCode() == 200) {
LOG.debug("Client has been successfully deleted");
} else {
String errorMessage = buffer.toString();
LOG.debugf("Client delete request has failed: status: %d, error message: %s", resp.statusCode(),
errorMessage);
}
})
.replaceWithVoid();
}
private void checkClosed() {
if (closed) {
throw new IllegalStateException("Registered OIDC Client is closed");
}
}
private void checkClientRequestUri() {
if (registrationClientUri == null) {
throw new OidcClientRegistrationException(
"Registered OIDC Client can not make requests to the client configuration endpoint");
}
}
@Override
public String registrationUri() {
return this.registrationClientUri;
}
@Override
public String registrationToken() {
return this.registrationToken;View on GitHub (pinned to e1c734241f)
Solutions
- Obtain a fresh RegisteredClient from OidcClientRegistration (register() or registration client) instead of reusing the closed one
- Re-order lifecycle logic so no calls happen after close(); guard background jobs with an is-closed check
- If the client was deleted intentionally, stop using it rather than attempting further reads/updates
Example fix
// before
registeredClient.close();
registeredClient.read(); // IllegalStateException
// after
if (registeredClient != null) {
registeredClient.read();
}
registeredClient.close(); Defensive patterns
Strategy: try-catch
Validate before calling
if (registeredClient == null) {
throw new IllegalStateException("no registered client available");
} Try / catch
try {
registeredClient.read();
} catch (IllegalStateException e) {
// client closed: reacquire from OidcClientRegistration
registeredClient = registrationClient.register(metadata).await().indefinitely();
} Prevention
- Close clients only at application shutdown, after all workers stop
- Reacquire clients from the registration client instead of caching closed instances
- Treat delete() as terminal for that instance
When it happens
Trigger: Calling any method (metadata, read, update, delete) on a RegisteredClient instance after close() has been called on it, or on a client whose registration was deleted and marked closed.
Common situations: Application shutdown or context restart closes the client while background tasks still hold a reference; singleton beans reusing a closed instance after a re-registration; calling read/update after delete() on the same client.
Related errors
- OIDC Client Registration is closed
- Services have not been started yet
- OidcClient %s is closed
- Unsupported JWT source: <source>
- RestClientProxy is closed
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/33846cf45b468fa7.
Report an issue: GitHub.