quarkusio/quarkus · error · RuntimeException
OIDC Token State Manager failed to create database table: <e
Error message
OIDC Token State Manager failed to create database table: <errMsg>
What it means
OidcDbTokenStateManagerInitializer.createDatabaseTable collects errors from the reactive SQL statements that create the oidc_db_token_state_manager table, then throws RuntimeException if any error message was captured. It signals the token state manager could not initialize its storage table in the database.
Source
Thrown at extensions/oidc-db-token-state-manager/runtime/src/main/java/io/quarkus/oidc/db/token/state/manager/runtime/OidcDbTokenStateManagerInitializer.java:149
return null;
}
// table does not exist
return FAILED_TO_CREATE_DB_TABLE;
}
})
.onFailure().recoverWithItem(new Function<Throwable, String>() {
@Override
public String apply(Throwable throwable) {
LOG.error("Create database query failed with: ", throwable);
return FAILED_TO_CREATE_DB_TABLE;
}
});
}
})
.await()
.indefinitely();
if (errMsg != null) {
throw new RuntimeException("OIDC Token State Manager failed to create database table: " + errMsg);
}
}
public enum SupportedReactiveSqlClient {
POSTGRESQL(true,
(int idToken, int accessToken, int refreshToken) -> "CREATE TABLE IF NOT EXISTS oidc_db_token_state_manager ("
+ "id VARCHAR(100) PRIMARY KEY, "
+ "id_token VARCHAR(" + idToken + "), "
+ "access_token VARCHAR(" + accessToken + "), "
+ "refresh_token VARCHAR(" + refreshToken + "), "
+ "access_token_expires_in BIGINT, "
+ "access_token_scope VARCHAR, "
+ "expires_in BIGINT NOT NULL)"),
DB2(false, (int idToken, int accessToken, int refreshToken) -> "CREATE TABLE oidc_db_token_state_manager ("
+ "id VARCHAR(100) NOT NULL PRIMARY KEY, "
+ "id_token VARCHAR(" + idToken + "), "
+ "access_token VARCHAR(" + accessToken + "), "
+ "refresh_token VARCHAR(" + refreshToken + "), "View on GitHub (pinned to e1c734241f)
Solutions
- Check errMsg / cause for the underlying database error (connection, auth, or SQL)
- Verify quarkus.datasource.reactive URL, credentials, and db-kind
- Ensure the database user has CREATE TABLE privileges on the schema
- Start the DB (docker-compose, devservices) and verify network reachability before app startup
Example fix
// before quarkus.datasource.db-kind=postgresql quarkus.datasource.reactive.url=postgresql://localhost:9999/db // after quarkus.datasource.reactive.url=postgresql://localhost:5432/db quarkus.datasource.username=app quarkus.datasource.password=secret
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight: verify datasource reachability before app start
try (Connection c = DriverManager.getConnection(jdbcUrl, user, pass)) {
// ok
} catch (SQLException e) {
throw new IllegalStateException("OIDC token state DB unreachable: " + e.getMessage());
} Try / catch
try {
initializer.initialize();
} catch (RuntimeException e) {
if (e.getMessage().startsWith("OIDC Token State Manager failed to create database table")) {
log.errorf("Check DB connectivity/privileges: %s", e.getCause());
}
throw e;
} Prevention
- Verify reactive datasource URL/credentials/db-kind before startup
- Grant the DB user CREATE TABLE rights
- Use devservices or testcontainers to ensure the DB is up during tests
When it happens
Trigger: The CREATE TABLE IF NOT EXISTS statement (dialect-specific per SupportedReactiveSqlClient) fails at startup: connection refused, bad credentials, missing schema, insufficient privileges, or dialect errors.
Common situations: Database not running or wrong host/port; wrong quarkus.datasource credentials; user lacking CREATE TABLE permission; the database is behind a firewall or the container isn't started in tests.
Related errors
- Only one of '%1$scredentials.jwt.key', '%1$scredentials.jwt.
- Failed to start Quarkus
- Quarkus failed to start up
- Unable to find top command. Ensure you have a @CommandDefini
- Quarkus initialization error
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/cb430767eb64315c.
Report an issue: GitHub.