{"record":{"id":"8de5d4d9868c691a","repo":"flowable/flowable-engine","slug":"the-attribute-must-resolve-to-an-number-or-a-s-8de5d4","errorCode":null,"errorMessage":"The [<attribute>] must resolve to an Number or a String that can be parsed as a Long. Resolved to [<class>] for [<value>]","messagePattern":"The \\[<attribute>\\] must resolve to an Number or a String that can be parsed as a Long\\. 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":477,"sourceCode":"        } else if (resolved instanceof Number) {\n            result = ((Number) resolved).intValue();\n        } else if (resolved != null) {\n            throw new IllegalStateException(\n                \"The [\" + attribute + \"] must resolve to an Number or a String that can be parsed as an Integer. \"\n                    + \"Resolved to [\" + resolved.getClass() + \"] for [\" + value + \"]\");\n        }\n        return result;\n    }\n\n    protected Long resolveExpressionAsLong(String value, String attribute) {\n        Object resolved = resolveExpression(value);\n        Long result = null;\n        if (resolved instanceof String) {\n            result = Long.parseLong((String) resolved);\n        } else if (resolved instanceof Number) {\n            result = ((Number) resolved).longValue();\n        } else if (resolved != null) {\n            throw new IllegalStateException(\n                    \"The [\" + attribute + \"] must resolve to an Number or a String that can be parsed as a Long. \"\n                            + \"Resolved to [\" + resolved.getClass() + \"] for [\" + value + \"]\");\n        }\n        return result;\n    }\n\n    protected Double resolveExpressionAsDouble(String value, String attribute) {\n        Object resolved = resolveExpression(value);\n        Double result = null;\n        if (resolved instanceof String) {\n            result = Double.parseDouble((String) resolved);\n        } else if (resolved instanceof Number) {\n            result = ((Number) resolved).doubleValue();\n        } else if (resolved != null) {\n            throw new IllegalStateException(\n                    \"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        }","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/kafka/KafkaChannelDefinitionProcessor.java#L459-L495","documentation":"resolveExpressionAsLong resolves an attribute expression for a Long-typed setting and accepts null, String-parseable-as-Long, or Number. Any other resolved type causes IllegalStateException. It is called by the retry backoff delay and max configuration, so a bad expression type in backoff settings triggers it.","triggerScenarios":"The delay or max attribute of a retry/backoff configuration in the Kafka channel model resolves (via expression/placeholder) to a non-Long, non-String object (e.g. Double or a bean) when the listener endpoint is created.","commonSituations":"YAML value with decimal point (1.5) where Long expected is fine as String? no—actually a resolved Double; property bound to a Duration object; placeholder pointing to wrong key returning a map/list.","solutions":["Ensure the delay/max expression resolves to a whole number or numeric String (e.g. 1000 or \"1000\").","Remove units/decimals from the configured value; use milliseconds as a plain integer.","Fix the backing property type to Long/long if it resolves from a bean field.","If a Duration is desired, convert to millis in the expression."],"exampleFix":"// before\nflowable:\n  kafka:\n    retry:\n      delay: 1.5s   # resolves to a Duration, not Long\n\n// after\nflowable:\n  kafka:\n    retry:\n      delay: 1500","handlingStrategy":"type-guard","validationCode":"Object v = resolveExpression(value);\nif (v != null && !(v instanceof Number) && !(v instanceof String)) throw new IllegalArgumentException(attribute + \" must be long-like\");","typeGuard":"boolean isLongLike(Object v) { return v == null || v instanceof Number || (v instanceof String s && s.matches(\"-?\\\\d+\")); }","tryCatchPattern":"try { ... } catch (IllegalStateException e) { if (e.getMessage().contains(\"parsed as a Long\")) { log.error(\"Backoff delay/max not a Long: {}\", e.getMessage()); } else throw e; }","preventionTips":["Specify backoff delay/max as plain integer milliseconds","Avoid Duration-typed properties for these attributes","Use default fallbacks in placeholders, e.g. ${delay:1000}"],"tags":["kafka","type-mismatch","retry-backoff","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"}