flowable/flowable-engine · error · FlowableIllegalArgumentException

Only string variable values are supported using like, but wa

Error message

Only string variable values are supported using like, but was: {valueClassName}

What it means

LIKE pattern matching on task variables is defined only for string values (SQL LIKE semantics). If the value of a LIKE filter resolves to a non-String type, TaskBaseResource.addTaskvariables throws this FlowableIllegalArgumentException.

Source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskBaseResource.java:455

                break;

            case GREATER_THAN_OR_EQUALS:
                taskQuery.taskVariableValueGreaterThanOrEqual(variable.getName(), actualValue);
                break;

            case LESS_THAN:
                taskQuery.taskVariableValueLessThan(variable.getName(), actualValue);
                break;

            case LESS_THAN_OR_EQUALS:
                taskQuery.taskVariableValueLessThanOrEqual(variable.getName(), actualValue);
                break;

            case LIKE:
                if (actualValue instanceof String) {
                    taskQuery.taskVariableValueLike(variable.getName(), (String) actualValue);
                } else {
                    throw new FlowableIllegalArgumentException("Only string variable values are supported using like, but was: " + actualValue.getClass().getName());
                }
                break;

            case LIKE_IGNORE_CASE:
                if (actualValue instanceof String) {
                    taskQuery.taskVariableValueLikeIgnoreCase(variable.getName(), (String) actualValue);
                } else {
                    throw new FlowableIllegalArgumentException("Only string variable values are supported using like, but was: " + actualValue.getClass().getName());
                }
                break;

            case EXISTS:
                taskQuery.taskVariableExists(variable.getName());
                break;

            case NOT_EXISTS:
                taskQuery.taskVariableNotExists(variable.getName());
                break;

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Convert the value to a JSON string in the request if the stored variable is actually a string
  2. Use 'equals'/'greaterThan' etc. for non-string variables instead of LIKE
  3. Store the data as a string variable if pattern matching is a requirement

Example fix

// before
{"name":"amount","operation":"like","value":10}
// after
{"name":"amount","operation":"equals","value":10}
Defensive patterns

Strategy: validation

Validate before calling

function validateLikeVar(v) {
  if ((v.operation === 'like') && typeof v.value !== 'string') {
    throw new Error(`like requires a string value, got ${typeof v.value}`);
  }
}

Type guard

const isLikeable = (v) => typeof v.value === 'string';

Try / catch

try {
  const res = await flowable.queryTasks(body);
} catch (e) {
  if (e.message && e.message.includes('using like')) {
    // convert value to string or use a comparison operator
  } else throw e;
}

Prevention

When it happens

Trigger: POST/GET /runtime/tasks with {"name":"amount","operation":"like","value":"10%"} — value is a number, failing the instanceof String check.

Common situations: Trying wildcard search on numeric or boolean variables; assuming Flowable coerces values to strings for LIKE; querying variables stored as Integer/Long with pattern filters.

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