flowable/flowable-engine · error · TypeException
Error setting null for parameter #${i} with JdbcType ${jdbcT
Error message
Error setting null for parameter #${i} with JdbcType ${jdbcType} . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: ${e} What it means
TypeException raised when ps.setNull(...) fails for a nullable String parameter in FlowableStringTypeHandler.setParameter. The handler already had a JdbcType but the driver rejected the setNull call; the message suggests choosing a different JdbcType or changing the jdbcTypeForNull configuration.
Source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/db/FlowableStringTypeHandler.java:41
if (parameter == null) {
if (jdbcType == null) {
throw new TypeException("JDBC requires that the JdbcType must be specified for all nullable parameters.");
}
try {
if (useDefaultJdbcType) {
JdbcType finalJdbcType = null;
if (jdbcType.equals(JdbcType.NVARCHAR)) {
finalJdbcType = JdbcType.VARCHAR;
} else {
finalJdbcType = jdbcType;
}
ps.setNull(i, finalJdbcType.TYPE_CODE);
} else {
ps.setNull(i, Types.NULL);
}
} catch (SQLException e) {
throw new TypeException("Error setting null for parameter #" + i + " with JdbcType " + jdbcType + " . "
+ "Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. "
+ "Cause: " + e, e);
}
} else {
try {
setNonNullParameter(ps, i, parameter, jdbcType);
} catch (Exception e) {
throw new TypeException("Error setting non null for parameter #" + i + " with JdbcType " + jdbcType + " . "
+ "Try setting a different JdbcType for this parameter or a different configuration property. " + "Cause: "
+ e, e);
}
}
}
@Override
public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, parameter);
}View on GitHub (pinned to d6d39ce1c6)
Solutions
- Change jdbcTypeForNull to a widely supported type such as VARCHAR in the MyBatis configuration.
- Adjust the jdbcType attribute in the mapper mapping to a type the driver accepts for setNull.
- Check the cause SQLException for the column constraint (NOT NULL violation means the value must be non-null).
- Update the JDBC driver to a version that handles the configured null JdbcType.
Example fix
// before configuration.setJdbcTypeForNullType(JdbcType.NULL); // after configuration.setJdbcTypeForNullType(JdbcType.VARCHAR);
Defensive patterns
Strategy: try-catch
Validate before calling
if (value == null) { /* ensure jdbcType is driver-supported: prefer VARCHAR, avoid NULL/OTHER */ } Try / catch
catch (TypeException e) { if (e.getMessage().startsWith("Error setting null")) { log.error("setNull failed for param", e.getCause()); /* switch jdbcTypeForNull */ } throw e; } Prevention
- Use jdbcTypeForNull=VARCHAR, not NULL/OTHER, on restrictive drivers.
- Check the driver docs for supported null JdbcTypes.
- Inspect cause SQLException to distinguish constraint vs. driver issues.
When it happens
Trigger: Binding null to parameter #i throws SQLException inside setNull(i, TYPE_CODE) or setNull(i, Types.NULL): driver doesn't support Types.NULL, column type incompatible with the configured JdbcType, or driver-specific limitations (e.g. some Oracle/driver combos with certain types).
Common situations: jdbcTypeForNull set to NULL/OTHER on drivers that reject it; custom mappings specifying an exotic jdbcType (e.g. NVARCHAR) unsupported by the driver for setNull; non-null expectation on a NOT NULL column surfaces as SQL error surfaced through this path.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- JDBC requires that the JdbcType must be specified for all nu
- Error setting non null for parameter #${i} with JdbcType ${j
- Exception while initializing Database connection
- There are app definitions with key = '' and version = ''
- CmmnRuntimeService cannot be null, Obtain your builder insta
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/3342826bb7d64840.
Report an issue: GitHub.