hibernate/hibernate-orm · error · IllegalArgumentException

Unknown type searchability code [${code}] encountered

Error message

Unknown type searchability code [${code}] encountered

What it means

Error "Unknown type searchability code [${code}] encountered" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/TypeSearchability.java:50

	 * @see DatabaseMetaData#typePredBasic
	 */
	BASIC;

	/**
	 * Based on the code retrieved from {@link DatabaseMetaData#getTypeInfo()} for the {@code SEARCHABLE}
	 * column, return the appropriate enum.
	 *
	 * @param code The retrieved code value.
	 *
	 * @return The corresponding enum.
	 */
	public static TypeSearchability interpret(short code) {
		return switch (code) {
			case DatabaseMetaData.typeSearchable -> FULL;
			case DatabaseMetaData.typePredNone -> NONE;
			case DatabaseMetaData.typePredBasic -> BASIC;
			case DatabaseMetaData.typePredChar -> CHAR;
			default -> throw new IllegalArgumentException( "Unknown type searchability code [" + code + "] encountered" );
		};
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use a valid DatabaseMetaData typeSearchability code when constructing TypeSearchability
  2. Handle unexpected codes defensively rather than relying on raw metadata values

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/TypeSearchability.java:50 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/f73253c80552e368. Report an issue: GitHub.