{"record":{"id":"4724e68b19b709c2","repo":"flowable/flowable-engine","slug":"value-value-can-not-be-converted-into-boolean","errorCode":null,"errorMessage":"Value \"${value}\" can not be converted into boolean","messagePattern":"Value \"(.+?)\" can not be converted into boolean","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/ExpressionUtils.java","lineNumber":61,"sourceCode":"        if (expression != null) {\n            Object value = expression.getValue(execution);\n            return parseBoolean(value);\n        }\n        return false;\n    }\n\n    protected static boolean parseBoolean(Object value) {\n        if (value != null) {\n            if (value instanceof String stringValue) {\n                if (\"true\".equalsIgnoreCase(stringValue) || \"false\".equalsIgnoreCase(stringValue)) {\n                    return Boolean.parseBoolean(value.toString());\n                }\n                throw new FlowableException(\"String value \\\"\" + value + \"\\\" is not allowed in boolean expression\");\n            }\n            if (value instanceof Boolean) {\n                return (Boolean) value;\n            }\n            throw new FlowableException(\"Value \\\"\" + value + \"\\\" can not be converted into boolean\");\n        }\n        return false;\n    }\n\n    public static String getStringFromField(final Expression expression, final VariableContainer execution) {\n        if (expression != null) {\n            Object value = expression.getValue(execution);\n            if (value != null) {\n                return value.toString();\n            }\n        }\n        return null;\n    }\n\n    public static Set<String> getStringSetFromField(final String field) {\n        String[] codes = field.split(\"\\\\s*,\\\\s*\");\n        Set<String> codeSet = new HashSet<>(Arrays.asList(codes));\n        Collections.addAll(codeSet, codes);","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/ExpressionUtils.java#L43-L79","documentation":"ExpressionUtils.parseBoolean throws this when the resolved field value is neither a String nor a Boolean and not null — e.g. an Integer, Long, or other object. Flowable refuses to guess a boolean conversion for arbitrary types, unlike the String path which at least accepts 'true'/'false' text.","triggerScenarios":"A boolean field expression resolves to a non-boolean, non-string object, e.g. ${flag} pointing at an Integer variable set to 1, or a serialized object stored in a process variable being used where a boolean is expected.","commonSituations":"Setting process variables from scripts as numbers (flag=1) and then using them in boolean task attributes; variables populated from a JSON/API response where booleans were deserialized as integers.","solutions":["Convert the variable to a real Boolean before the HTTP task (Boolean.valueOf or explicit set in a script/listener)","Change the expression to a coercion, e.g. ${flag == 1} when the variable is numeric","Fix the upstream producer of the variable (script task, REST response mapping) to emit booleans"],"exampleFix":"// before\nexecution.setVariable(\"retryFlag\", 1);\n// after\nexecution.setVariable(\"retryFlag\", true);","handlingStrategy":"type-guard","validationCode":"Object v = execution.getVariable(\"flag\");\nif (!(v instanceof Boolean) && !(v instanceof String s && (s.equalsIgnoreCase(\"true\") || s.equalsIgnoreCase(\"false\")))) {\n    throw new IllegalArgumentException(\"flag must be Boolean or 'true'/'false' string\");\n}","typeGuard":"boolean isBooleanLike(Object v) { return v instanceof Boolean b || (v instanceof String s && (s.equalsIgnoreCase(\"true\") || s.equalsIgnoreCase(\"false\"))); }","tryCatchPattern":null,"preventionTips":["Never store numeric 1/0 for boolean flags consumed by HTTP task fields","Ensure API/JSON deserialization maps booleans to Boolean, not Integer","Coerce in a script task immediately before the HTTP task"],"tags":["flowable","boolean","type-mismatch","expression"],"backgroundTag":"type-mismatch","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}