flowable/flowable-engine · error · FlowableIllegalArgumentException
Only string variable values are supported for like, but was:
Error message
Only string variable values are supported for like, but was: " + actualValue.getClass().getName()
What it means
The LIKE variable query operation performs SQL-style pattern matching, which only makes sense for String variables. If the resolved value is not a String, addVariables throws FlowableIllegalArgumentException including the actual value's class name.
Source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/history/HistoricProcessInstanceBaseResource.java:356
break;
case EQUALS_IGNORE_CASE:
if (actualValue instanceof String) {
processInstanceQuery.variableValueEqualsIgnoreCase(variable.getName(), (String) actualValue);
} else {
throw new FlowableIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: " + actualValue.getClass().getName());
}
break;
case NOT_EQUALS:
processInstanceQuery.variableValueNotEquals(variable.getName(), actualValue);
break;
case LIKE:
if (actualValue instanceof String) {
processInstanceQuery.variableValueLike(variable.getName(), (String) actualValue);
} else {
throw new FlowableIllegalArgumentException("Only string variable values are supported for like, but was: " + actualValue.getClass().getName());
}
break;
case LIKE_IGNORE_CASE:
if (actualValue instanceof String) {
processInstanceQuery.variableValueLikeIgnoreCase(variable.getName(), (String) actualValue);
} else {
throw new FlowableIllegalArgumentException("Only string variable values are supported for like, but was: "
+ actualValue.getClass().getName());
}
break;
case GREATER_THAN:
processInstanceQuery.variableValueGreaterThan(variable.getName(), actualValue);
break;
case GREATER_THAN_OR_EQUALS:
processInstanceQuery.variableValueGreaterThanOrEqual(variable.getName(), actualValue);View on GitHub (pinned to d6d39ce1c6)
Solutions
- Use EQUALS, GREATER_THAN, etc. for non-String variables and reserve LIKE for text
- Send the value as a JSON string when a textual pattern match is intended
- Convert the numeric/date variable's value to a String variable in the process definition if pattern search is required
Example fix
// before
{"name":"amount","type":"long","value":500,"variableOperation":"LIKE"}
// after
{"name":"description","value":"%refund%","variableOperation":"LIKE"} Defensive patterns
Strategy: validation
Validate before calling
if (variable.variableOperation === 'LIKE' && typeof variable.value !== 'string') throw new Error('LIKE requires a string value'); Type guard
const isString = (v) => typeof v === 'string';
Try / catch
catch (e) { if (e.response && e.response.status === 400) { console.error(e.response.data.message); } throw e; } Prevention
- Reserve LIKE/LIKE_IGNORE_CASE for string variables
- Add wildcard patterns as strings with % escapes
- Restrict operation choices in UI by variable type
When it happens
Trigger: History process instance query requests with a variable whose variableOperation is LIKE but whose value is a number, boolean, date, or other non-String type.
Common situations: Querying numeric variables with wildcard patterns assuming implicit conversion; passing dates to LIKE expecting string formatting; generic query builders that reuse one value type across operations.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Only string variable values are supported for like, but was:
- Only string variable values are supported when ignoring casi
- Only string variable values are supported when ignoring casi
- Only string variable values are supported when ignoring casi
- Only string variable values are supported using like, but wa
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/8b9ad5b6cd98b099.
Report an issue: GitHub.