{"record":{"id":"197ef8e80005e43c","repo":"flowable/flowable-engine","slug":"partition-in-topicpartition-for-topic-topic-ca","errorCode":null,"errorMessage":"partition in TopicPartition for topic '<topic>' can't resolve '<resolvedValue>' as an Integer or String","messagePattern":"partition in TopicPartition for topic '<topic>' can't resolve '<resolvedValue>' as an Integer or String","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/kafka/KafkaChannelDefinitionProcessor.java","lineNumber":643,"sourceCode":"                    .collect(Collectors.toList());\n            result.addAll(collected);\n        }\n        else if (resolvedValue instanceof Integer[]) {\n            for (Integer partition : (Integer[]) resolvedValue) {\n                result.add(new TopicPartitionOffset(topic, partition));\n            }\n        }\n        else if (resolvedValue instanceof Integer) {\n            result.add(new TopicPartitionOffset(topic, (Integer) resolvedValue));\n        }\n        else if (resolvedValue instanceof Iterable) {\n            //noinspection unchecked\n            for (Object object : (Iterable<Object>) resolvedValue) {\n                resolvePartitionAsInteger(topic, object, result);\n            }\n        }\n        else {\n            throw new IllegalArgumentException(\n                    \"partition in TopicPartition for topic '\" + topic + \"' can't resolve '\" + resolvedValue + \"' as an Integer or String\");\n        }\n    }\n\n    /**\n     * Parse a list of partitions into a {@link List}. Example: \"0-5,10-15\".\n     * This parsing is the same as it is done in the Spring {@code KafkaListenerAnnotationBeanPostProcessor}.\n     *\n     * @param partsString the comma-delimited list of partitions/ranges.\n     * @return the stream of partition numbers, sorted and de-duplicated.\n     */\n    protected Stream<Integer> parsePartitions(String partsString) {\n        // This is the same as it is done in the Spring KafkaListenerAnnotationBeanPostProcessor#parsePartitions\n        String[] partsStrings = partsString.split(\",\");\n        if (partsStrings.length == 1 && !partsStrings[0].contains(\"-\")) {\n            return Stream.of(Integer.parseInt(partsStrings[0].trim()));\n        }\n        List<Integer> parts = new ArrayList<>();","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/kafka/KafkaChannelDefinitionProcessor.java#L625-L661","documentation":"Thrown by resolvePartitionAsInteger when a resolved partition value from the channel model is neither an Integer nor a String (nor an Iterable of such). The library only knows how to parse partitions given as integers or numeric strings, so any other resolved type is rejected with this IllegalArgumentException at channel definition processing time.","triggerScenarios":"A TopicPartition 'partition' attribute resolves (via eventField, fixedValue or delegateExpression) to a non-Integer, non-String object such as a Long, a Map, or a POJO that is not Iterable of Integer/String.","commonSituations":"A delegateExpression returning Long partition numbers, a fixedValue written as a JSON object instead of a number/string, or an event field carrying a non-numeric value.","solutions":["Ensure the partition attribute resolves to an Integer or a numeric String (e.g. \"0-5,10\" ranges are handled elsewhere; single values must be Integer or String).","If using a delegateExpression, make the KafkaPartitionProvider return Integer partitions (convert Long to Integer).","Check the event payload field referenced by eventField holds a number or numeric string, not an object.","Wrap the value: return String.valueOf(rawValue) or Integer.valueOf(rawValue.toString()) in your provider."],"exampleFix":"// before\npublic KafkaPartitionProvider provide() { return ignore -> 3L; } // Long\n// after\npublic KafkaPartitionProvider provide() { return ignore -> 3; } // Integer","handlingStrategy":"validation","validationCode":"Object v = resolvePartitionValue();\nif (!(v instanceof Integer) && !(v instanceof String)) {\n    throw new IllegalArgumentException(\"partition value must be Integer or String, got: \" + v.getClass());\n}","typeGuard":"boolean isValidPartition(Object v) {\n    return v instanceof Integer || v instanceof String;\n}","tryCatchPattern":"try {\n    channelRuntimeBuilder.build(channelModel);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"can't resolve\")) {\n        log.error(\"Bad partition value in channel model\", e);\n    } else { throw e; }\n}","preventionTips":["Always model partition values as Integer or numeric String in event payloads","Unit-test delegateExpressions supplying partitions to confirm returned types","Validate channel model JSON against the event-registry schema before deploy"],"tags":["kafka","event-registry","type-mismatch","configuration"],"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"}