{"record":{"id":"0b6a2c3e09203b74","repo":"flowable/flowable-engine","slug":"channel-definition-channeldefinition-cannot-reso","errorCode":null,"errorMessage":"Channel definition <channelDefinition> cannot resolve <resolvedValue> as a String[] or a String","messagePattern":"Channel definition <channelDefinition> cannot resolve <resolvedValue> as a String\\[\\] or a 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":560,"sourceCode":"        }\n\n        return resultTopics;\n    }\n\n    protected void resolveTopics(Object resolvedValue, List<String> result, KafkaInboundChannelModel channelDefinition) {\n        if (resolvedValue instanceof String[]) {\n            for (String object : (String[]) resolvedValue) {\n                resolveTopics(object, result, channelDefinition);\n            }\n\n        } else if (resolvedValue instanceof String) {\n            result.add((String) resolvedValue);\n        } else if (resolvedValue instanceof Iterable) {\n            for (Object object : (Iterable<?>) resolvedValue) {\n                resolveTopics(object, result, channelDefinition);\n            }\n        } else {\n            throw new IllegalArgumentException(\n                \"Channel definition \" + channelDefinition + \" cannot resolve \" + resolvedValue + \" as a String[] or a String\");\n        }\n    }\n\n    protected Pattern resolvePattern(KafkaInboundChannelModel channelModel) {\n        Pattern pattern = null;\n        String topicPattern = channelModel.getTopicPattern();\n        if (StringUtils.hasText(topicPattern)) {\n            Object resolved = resolveExpression(topicPattern);\n            if (resolved instanceof String) {\n                pattern = Pattern.compile((String) resolved);\n            } else if (resolved instanceof Pattern) {\n                pattern = (Pattern) resolved;\n            } else if (resolved != null) {\n                throw new IllegalStateException(\n                    \"topicPattern in channel model [ \" + channelModel + \" ] must resolve to a Pattern or String, not \" + resolved.getClass());\n            }\n        }","sourceCodeStart":542,"sourceCodeEnd":578,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/kafka/KafkaChannelDefinitionProcessor.java#L542-L578","documentation":"resolveTopics resolves the topics attribute of a Kafka inbound channel; the resolved value must be a String, a String[]/array of Strings, or an Iterable containing Strings. Any other resolved type triggers IllegalArgumentException naming the channel definition and the offending value. This validates the multi-topic configuration at endpoint creation time.","triggerScenarios":"The channel's topics attribute expression resolves to e.g. a List of Integers, a Map, or a single non-String object; resolveTopics recursion hits an element that is neither String, String[], nor Iterable.","commonSituations":"topics: [1,2,3] numeric list in model; placeholder points to a Map of topic->options; mixed-type array from environment variables.","solutions":["Ensure every topic entry is a String, e.g. topics: [\"orders\", \"payments\"].","Fix the placeholder/expression so it resolves to String[] or List<String>.","If using a Map, flatten to a list of keys (e.g. ${...keys} style) before assigning.","Quote numeric topic names so they stay Strings."],"exampleFix":"// before\ntopics: [101, 102]\n\n// after\ntopics: [\"101\", \"102\"]","handlingStrategy":"validation","validationCode":"Object resolved = resolveExpression(topicsValue);\nboolean ok = resolved instanceof String\n    || resolved instanceof String[]\n    || (resolved instanceof Iterable<?> it && StreamSupport.stream(it.spliterator(), false).allMatch(o -> o instanceof String));\nif (!ok) throw new IllegalArgumentException(\"topics must resolve to String or String[]/Iterable<String>\");","typeGuard":null,"tryCatchPattern":"try { ... } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"as a String[] or a String\")) { log.error(\"Bad topics config: {}\", e.getMessage()); } else throw e; }","preventionTips":["Model topics as a list of quoted strings","Do not bind topics to Maps or mixed-type collections","Validate channel model JSON against a schema allowing only strings in topics"],"tags":["kafka","type-mismatch","topics","validation"],"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"}