{"record":{"id":"1a3343abd87d8dcc","repo":"flowable/flowable-engine","slug":"skip-expression-does-not-resolve-to-a-boolean-s","errorCode":null,"errorMessage":"Skip expression does not resolve to a boolean: ${skipExpression.getExpressionText()}","messagePattern":"Skip expression does not resolve to a boolean: (.+?)","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/SkipExpressionUtil.java","lineNumber":48,"sourceCode":"        if (isSkipExpressionEnabled == null) {\n            return false;\n\n        } else if (isSkipExpressionEnabled instanceof Boolean) {\n            return ((Boolean) isSkipExpressionEnabled).booleanValue();\n\n        } else {\n            throw new ActivitiIllegalArgumentException(skipExpressionEnabledVariable + \" variable does not resolve to a boolean. \" + isSkipExpressionEnabled);\n        }\n    }\n\n    public static boolean shouldSkipFlowElement(DelegateExecution execution, Expression skipExpression) {\n        Object value = skipExpression.getValue(execution);\n\n        if (value instanceof Boolean) {\n            return ((Boolean) value).booleanValue();\n\n        } else {\n            throw new ActivitiIllegalArgumentException(\"Skip expression does not resolve to a boolean: \" + skipExpression.getExpressionText());\n        }\n    }\n}\n","sourceCodeStart":30,"sourceCodeEnd":52,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/SkipExpressionUtil.java#L30-L52","documentation":"Thrown as ActivitiIllegalArgumentException from SkipExpressionUtil.shouldSkipFlowElement when the evaluated skipExpression does not return a Boolean. Skip expressions on service tasks etc. must resolve to true or false; any other result type causes the engine to fail the execution.","triggerScenarios":"A flow element declares <activiti:skipExpression> whose expression evaluates to a non-Boolean value — e.g. \"${condition}\" where condition is a String, Integer, or null — and the element is executed with skip enabled.","commonSituations":"Expressions that compare values and accidentally return a String; expressions referencing a null variable (result is null, not Boolean); writing an expression like ${var1 + var2} producing a number; copy-pasting a condition used elsewhere as text.","solutions":["Rewrite the skip expression to return a strict boolean: ${var == 'expected'} instead of ${var}.","Handle null in the expression: ${myVar != null && myVar.flag} or provide a default value for the variable.","If the underlying value is a String \"true\"/\"false\", coerce it: ${Boolean.parseBoolean(myVar)}.","Verify the referenced variable's type in the process instance before the activity executes."],"exampleFix":"// before: evaluates to String\n<activiti:skipExpression>${skipFlag}</activiti:skipExpression>\n\n// after: guaranteed Boolean\n<activiti:skipExpression>${Boolean.parseBoolean(skipFlag)}</activiti:skipExpression>","handlingStrategy":"validation","validationCode":"// ensure the referenced variable is a Boolean before the skip-enabled activity runs\nObject skipFlag = runtimeService.getVariable(executionId, \"skipFlag\");\nif (!(skipFlag instanceof Boolean)) {\n    throw new IllegalStateException(\"skipFlag must resolve to Boolean for the skip expression\");\n}","typeGuard":"boolean resolvesToBoolean(Expression expr, DelegateExecution execution) {\n    try { return expr.getValue(execution) instanceof Boolean; }\n    catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n    // run activity with skipExpression\n    taskService.complete(taskId, vars);\n} catch (ActivitiIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Skip expression does not resolve to a boolean\")) {\n        logger.error(\"Check skipExpression '{}' — it must return Boolean\", exprText);\n    }\n    throw e;\n}","preventionTips":["Write skip expressions as boolean comparisons, e.g. ${a == 'x'}, not bare variable references.","Guard against null variables inside the expression.","Unit-test skip expressions with representative variable values.","Never let arithmetic/string expressions feed skipExpression."],"tags":["bpmn","skip-expression","expression","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}