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: 

What it means

The CMMN historic task query REST endpoint applies a variable filter with the LIKE operation, but LIKE can only be expressed on string variable values. In HistoricTaskInstanceBaseResource.addTaskVariables the code checks `actualValue instanceof String` and throws FlowableIllegalArgumentException when the deserialized variable value is any other type. This is a hard constraint of the underlying taskInstanceQuery.taskVariableValueLike API.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/task/HistoricTaskInstanceBaseResource.java:388

                break;

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

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

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

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

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

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Quote the variable value in the JSON query so it is parsed as a String (e.g. "123" instead of 123).
  2. Change variableOperation to EQUALS / GREATER_THAN / LESS_THAN, which support non-string types.
  3. Ensure restResponseFactory.getVariableValue infers a string type for this variable (check the type field sent with the variable).
  4. Catch FlowableIllegalArgumentException on the client and fall back to an equals query.

Example fix

// before
{"name": "priority", "value": 10, "variableOperation": "LIKE"}
// after
{"name": "priority", "value": "10", "variableOperation": "LIKE"}
Defensive patterns

Strategy: validation

Validate before calling

// Java client-side
if ("LIKE".equals(v.getVariableOperation()) && !(v.getValue() instanceof String)) {
    throw new IllegalArgumentException("LIKE requires a string value for variable: " + v.getName());
}

Try / catch

try { result = historicTaskApi.queryTasks(query); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().contains("Only string variable values are supported using like")) { /* retry with EQUALS */ } else { throw e; } }

Prevention

When it happens

Trigger: Calling GET /cmmn-history/historic-task-instances with a query variable whose variableOperation=LIKE (or via the taskVariable filter parameter) while the variable value deserializes to a non-string type such as Integer, Long, Boolean, Date or Double.

Common situations: Clients reuse the same request body across numeric and string filters; JSON sends unquoted numbers (e.g. 123 instead of "123") with operation LIKE; a query builder UI always emits LIKE regardless of variable type.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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