flowable/flowable-engine · error · FlowableIllegalArgumentException

Only string variable values are supported for like, but…

Error message

Only string variable values are supported for like, but was: " + actualValue.getClass().getName()

What it means

addVariables throws this FlowableIllegalArgumentException when the LIKE variable query operation is used with a non-String value. SQL LIKE matching is a string operation, so Flowable requires the actualValue to be a String before calling processInstanceQuery.variableValueLike.

Solutions

  1. Send the LIKE pattern as a JSON string, including wildcards like "%" where intended
  2. Use EQUALS for exact non-string matches
  3. Cast the value to a string in your client before building the request

Example fix

// before
{"name":"count","value":100,"operation":"like"}
// after
{"name":"count","value":"100%","operation":"like"}
Defensive patterns

Strategy: validation

Validate before calling

if (operation === 'like' && typeof value !== 'string') throw new Error('like requires a string pattern, got: ' + typeof value);

Type guard

function isLikeReady(v) { return typeof v === 'string'; }

Try / catch

try { await query(queryBody); } catch (e) { if (e.message.includes('supported for like')) { /* fall back to EQUALS with the raw typed value */ } }

Prevention

When it happens

Trigger: Process-instance query with variableOperation=LIKE and a value that is a number, boolean, or other non-string type (e.g. {"value":123,"operation":"like"}).

Common situations: Users forgetting that LIKE patterns must be strings, e.g. sending 123 instead of "123%"; Swagger clients preserving the numeric type from a previous query; building queries programmatically from untyped maps.

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

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseProcessInstanceResource.java:332

                break;

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

            case NOT_EQUALS_IGNORE_CASE:
                if (actualValue instanceof String) {
                    processInstanceQuery.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) {
                    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);
                break;

View on GitHub (pinned to d6d39ce1c6)