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

Guard in HistoricCaseInstanceBaseResource.addVariables for the LIKE operations: SQL LIKE matching only supports string values, but the supplied variable value is of a non-string type (class name in message).

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/caze/HistoricCaseInstanceBaseResource.java:354

                break;

            case EQUALS_IGNORE_CASE:
                if (actualValue instanceof String) {
                    caseInstanceQuery.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:
                caseInstanceQuery.variableValueNotEquals(variable.getName(), actualValue);
                break;

            case LIKE:
                if (actualValue instanceof String) {
                    caseInstanceQuery.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) {
                    caseInstanceQuery.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:
                caseInstanceQuery.variableValueGreaterThan(variable.getName(), actualValue);
                break;

            case GREATER_THAN_OR_EQUALS:
                caseInstanceQuery.variableValueGreaterThanOrEqual(variable.getName(), actualValue);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Send the value as a JSON string: "value":"123"
  2. Use equals/greaterThan for non-string comparisons instead of like
  3. Include LIKE wildcards (%) in the string value as needed
  4. Coerce the value to string client-side before building the payload

Example fix

// before
{"name":"orderId","operation":"like","value":12345}
// after
{"name":"orderId","operation":"like","value":"12345%"}
Defensive patterns

Strategy: type-guard

Validate before calling

if ("like".equals(op) && !(value instanceof String))
  throw new IllegalArgumentException("like requires a String value");

Type guard

boolean likeValueIsString(Object value) { return value instanceof String; }

Try / catch

try { ... } catch (FlowableIllegalArgumentException e) {
  return badRequest("LIKE requires a string value");
}

Prevention

When it happens

Trigger: POST query with {"name":"x","operation":"like","value":123} — value resolves to a non-String type.

Common situations: Numeric ids passed to like without quotes; client library sends raw numbers; developer expects implicit toString conversion.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/3f7d68e1e225a559. Report an issue: GitHub.