{"record":{"id":"e2e9359a048ae138","repo":"flowable/flowable-engine","slug":"the-attribute-must-resolve-to-a-boolean-or-a-s","errorCode":null,"errorMessage":"The [<attribute>] must resolve to a Boolean or a String that can be parsed as a Boolean. Resolved to [<class>] for [<value>]","messagePattern":"The \\[<attribute>\\] must resolve to a Boolean or a String that can be parsed as a Boolean\\. Resolved to \\[<class>\\] for \\[<value>\\]","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/kafka/KafkaChannelDefinitionProcessor.java","lineNumber":511,"sourceCode":"                    \"The [\" + attribute + \"] must resolve to an Number or a String that can be parsed as a Double. \"\n                            + \"Resolved to [\" + resolved.getClass() + \"] for [\" + value + \"]\");\n        }\n        return result;\n    }\n\n    protected Boolean resolveExpressionAsBoolean(String value, String attribute) {\n        return resolveExpressionAsBoolean(value, attribute, null);\n    }\n\n    protected Boolean resolveExpressionAsBoolean(String value, String attribute, Boolean defaultValue) {\n        Object resolved = resolveExpression(value);\n        Boolean result = defaultValue;\n        if (resolved instanceof String) {\n            result = Boolean.parseBoolean((String) resolved);\n        } else if (resolved instanceof Boolean) {\n            result = (Boolean) resolved;\n        } else if (resolved != null) {\n            throw new IllegalStateException(\n                    \"The [\" + attribute + \"] must resolve to a Boolean or a String that can be parsed as a Boolean. \"\n                            + \"Resolved to [\" + resolved.getClass() + \"] for [\" + value + \"]\");\n        }\n        return result;\n    }\n\n    protected String resolveExpressionAsString(String value, String attribute) {\n        if (!StringUtils.hasLength(value)) {\n            return null;\n        }\n        Object resolved = resolveExpression(value);\n        if (resolved instanceof String) {\n            return (String) resolved;\n        } else {\n            throw new IllegalStateException(\"The [\" + attribute + \"] must resolve to a String. \"\n                + \"Resolved to [\" + resolved.getClass() + \"] for [\" + value + \"]\");\n        }\n    }","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/kafka/KafkaChannelDefinitionProcessor.java#L493-L529","documentation":"resolveExpressionAsBoolean resolves a channel-model attribute to Boolean and accepts Boolean, Boolean.parseBoolean-able String, or null; any other resolved type throws IllegalStateException with the attribute name, class, and raw value. Used for flags in resolveRetryConfiguration and recursive calls.","triggerScenarios":"A boolean channel attribute (e.g. autoCreateTopics, autoStartup) is expressed as an expression resolving to a non-Boolean object such as Integer or Map when the Kafka listener endpoint is configured.","commonSituations":"YAML value like autoCreateTopics: 1 (Integer) via placeholder resolution; expression returning Optional or custom wrapper; property pointing to a numeric env var (AUTO_CREATE=1).","solutions":["Use true/false or \"true\"/\"false\" values for the attribute.","Change the backing property/env var to a boolean (AUTO_CREATE=true instead of 1).","Fix the expression to return Boolean, e.g. ${flag} != 0 style conversion.","Verify no custom property resolver returns boxed numbers for boolean keys."],"exampleFix":"// before\nauto-create-topics: ${KAFKA_AUTO_CREATE}   # env var is \"1\"\n\n// after\nauto-create-topics: ${KAFKA_AUTO_CREATE:false}  # and set KAFKA_AUTO_CREATE=true","handlingStrategy":"type-guard","validationCode":"Object v = resolveExpression(value);\nif (v != null && !(v instanceof Boolean) && !(v instanceof String)) throw new IllegalArgumentException(attribute + \" must be boolean-like\");","typeGuard":"boolean isBooleanLike(Object v) { return v == null || v instanceof Boolean || v instanceof String; }","tryCatchPattern":"try { ... } catch (IllegalStateException e) { if (e.getMessage().contains(\"parsed as a Boolean\")) { log.error(\"Flag attribute wrong type: {}\", e.getMessage()); } else throw e; }","preventionTips":["Use true/false literals for boolean channel attributes","Set env vars to true/false, not 1/0","Add defaults in placeholders, e.g. ${flag:false}"],"tags":["kafka","type-mismatch","boolean","expression-resolution"],"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"}