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 matches string patterns only. If a query variable with operation LIKE carries a non-String value, BaseCaseInstanceResource.addVariables throws FlowableIllegalArgumentException reporting the value's Java class.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseCaseInstanceResource.java:355

                break;

            case NOT_EQUALS:
                caseInstanceQuery.variableValueNotEquals(variable.getName(), actualValue);
                break;

            case NOT_EQUALS_IGNORE_CASE:
                if (actualValue instanceof String) {
                    caseInstanceQuery.variableValueNotEqualsIgnoreCase(variable.getName(), (String) actualValue);
                } else {
                    throw new FlowableIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: " + actualValue.getClass().getName());
                }
                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);
                break;

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Send the LIKE value as a JSON string (quote it)
  2. Use EQUALS for exact non-string comparisons
  3. Ensure the client library serializes the value as String for pattern operations

Example fix

// before
{"name":"businessKey","value":1001,"operation":"LIKE"}
// after
{"name":"businessKey","value":"1001","operation":"LIKE"}
Defensive patterns

Strategy: validation

Validate before calling

if (variable.operation === 'LIKE' && typeof variable.value !== 'string') {
  throw new Error('LIKE requires a string value');
}

Type guard

const isString = (v) => typeof v === 'string';

Try / catch

null

Prevention

When it happens

Trigger: POST case-instance query where a variable has operation LIKE and value is not a String (e.g. number or boolean).

Common situations: Sending unquoted JSON numbers for pattern matching; clients assuming LIKE accepts any comparable type; generated clients serializing values as native JSON types.

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/aef052f29e9aac16. Report an issue: GitHub.