hibernate/hibernate-orm · error · IllegalArgumentException
Null value passed to convert
Error message
Null value passed to convert
What it means
WrapperArrayHandling.interpretExternalSetting(Object) (WrapperArrayHandling.java:56-58) converts the raw value of the hibernate.type.wrapper_array_handling property into the enum, and rejects a null input with IllegalArgumentException 'Null value passed to convert'. 'Null' here means the key was present in the configuration map with a null value (or null was passed programmatically) - an absent key never reaches this method. The lenient sibling interpretExternalSettingLeniently exists for optional resolutions.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/type/WrapperArrayHandling.java:61
* @see CharacterArrayJavaType
*
* @implNote The pre-6.2 behavior
* @apiNote Hibernate recommends users who want the legacy semantic change the domain model to use
* {@code byte[]} and {@code char[]} rather than using this setting.
*/
LEGACY,
/**
* Hibernate will pick between {@linkplain #ALLOW} and {@linkplain #LEGACY} depending on
* whether the Dialect supports SQL {@code ARRAY} types.
*
* @implNote The default if {@linkplain AvailableSettings#JPA_COMPLIANCE JPA compliance} is enabled.
*/
PICK;
public static WrapperArrayHandling interpretExternalSetting(Object value) {
if ( value == null ) {
throw new IllegalArgumentException( "Null value passed to convert" );
}
return value instanceof WrapperArrayHandling wrapperArrayHandling
? wrapperArrayHandling
: valueOf( value.toString().toUpperCase( Locale.ROOT ) );
}
/**
* Form of {@link #interpretExternalSetting(Object)} which allows incoming {@code null} values and
* simply returns {@code null}. Useful for chained resolutions
*/
public static WrapperArrayHandling interpretExternalSettingLeniently(@Nullable Object value) {
if ( value == null ) {
return null;
}
return value instanceof WrapperArrayHandling wrapperArrayHandling
? wrapperArrayHandlingView on GitHub (pinned to fad1729dce)
Solutions
- Remove the null-valued entry from the configuration map so the key is absent rather than null.
- In code that reads optional settings, use interpretExternalSettingLeniently(value), which returns null for null input.
- Set an explicit valid value: ALLOW, LEGACY, or PICK (uppercase; interpretation uses valueOf on the uppercased string).
- Sanitize properties before passing them to EntityManagerFactory setup: drop entries whose value is null.
Example fix
// before
Map<String, Object> props = new HashMap<>();
props.put("hibernate.type.wrapper_array_handling",
System.getProperty("hibernate.type.wrapper_array_handling")); // null when unset
// after
String v = System.getProperty("hibernate.type.wrapper_array_handling");
if (v != null) {
props.put("hibernate.type.wrapper_array_handling", v);
} Defensive patterns
Strategy: validation
Validate before calling
// Strip null-valued Hibernate settings before bootstrap
props.entrySet().removeIf(e -> e.getValue() == null);
// or, when reading optional settings in your own code:
WrapperArrayHandling h = value == null
? null
: WrapperArrayHandling.interpretExternalSettingLeniently(value); Try / catch
try {
return WrapperArrayHandling.interpretExternalSetting(value);
} catch (IllegalArgumentException e) {
if ("Null value passed to convert".equals(e.getMessage())) {
return WrapperArrayHandling.PICK; // document this default choice
}
throw e;
} Prevention
- Never put keys with null values into JPA/Hibernate property maps; absence means default, null means broken.
- Prefer interpretExternalSettingLeniently for optional chained setting resolution.
- Sanitize environment-derived properties (unset vars) before they reach Hibernate.
When it happens
Trigger: Configuration map containing hibernate.type.wrapper_array_handling -> null (e.g. properties.put(key, System.getProperty(key)) where the system property is unset); Spring Environment resolving the key to null but still registering it in JPA properties; custom bootstrap code calling WrapperArrayHandling.interpretExternalSetting(null); spreadsheets/CI variables that define the key with an empty expansion that later becomes null.
Common situations: Property files with 'hibernate.type.wrapper_array_handling=' handled as null by a custom loader; conditional configuration code that adds the key whenever a feature flag exists without checking the value; copying settings between environments where one env omits the value; libraries wrapping Hibernate settings that preserve null entries.
Related errors
- The {storageEngine} storage engine is not supported
- Could not instantiate event listener '{}'
- Unable to instantiate StatementObserver - {}
- No ServiceRegistry was passed to Configuration#buildSessionF
- illegal value for configuration setting 'hibernate.connectio
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/0fa9b3e62e6f1169.
Report an issue: GitHub.