{"record":{"id":"5cd16261328a9375","repo":"nathanmarz/storm","slug":"field-name-must-be-an-iterable-of-cls-getname","errorCode":null,"errorMessage":"Field ${name} must be an Iterable of ${cls.getName()}","messagePattern":"Field (.+?) must be an Iterable of (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/backtype/storm/ConfigValidation.java","lineNumber":63,"sourceCode":"        return new FieldValidator() {\n            @Override\n            public void validateField(String name, Object field)\n                    throws IllegalArgumentException {\n                if (field == null) {\n                    // A null value is acceptable.\n                    return;\n                }\n                if (field instanceof Iterable) {\n                    for (Object e : (Iterable)field) {\n                        if (! cls.isInstance(e)) {\n                            throw new IllegalArgumentException(\n                                    \"Each element of the list \" + name + \" must be a \" +\n                                    cls.getName() + \".\");\n                        }\n                    }\n                    return;\n                }\n                throw new IllegalArgumentException(\n                        \"Field \" + name + \" must be an Iterable of \" + cls.getName());\n            }\n        };\n    }\n\n    /**\n     * Validates a list of Numbers.\n     */\n    public static Object NumbersValidator = FieldListValidatorFactory(Number.class);\n\n    /**\n     * Validates is a list of Strings.\n     */\n    public static Object StringsValidator = FieldListValidatorFactory(String.class);\n\n    /**\n     * Validates is a list of Maps.\n     */","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/backtype/storm/ConfigValidation.java#L45-L81","documentation":"After element checks pass, the validator requires the field value itself to be an Iterable. If the value is null-typed as non-iterable or not an Iterable at all, validateField throws this IllegalArgumentException. It is the fallback when the field cannot be validated as a list of the given class.","triggerScenarios":"Passing a non-Iterable value (String, Integer, Map) for a config key validated as a list-of-T, so `field instanceof Iterable` is false and control reaches the final throw.","commonSituations":"Setting a single value instead of a list in storm.yaml (e.g. `drpc.servers: server1` instead of a YAML list); typo making the value a scalar; programmatic conf Maps with scalars where lists are required.","solutions":["Wrap the value in a list (YAML: `[value]` or block list syntax).","Verify the config key requires a list and you are not confusing it with a scalar key.","If set programmatically, use Arrays.asList(...) / Collections.singletonList(...) for the Map value."],"exampleFix":"// before\nconf.put(Config.DRPC_SERVERS, \"drpc-host\");\n// after\nconf.put(Config.DRPC_SERVERS, Arrays.asList(\"drpc-host\"));","handlingStrategy":"validation","validationCode":"Object v = conf.get(key);\nif (!(v instanceof List)) {\n    throw new IllegalStateException(key + \" must be a list, got: \" + (v == null ? \"null\" : v.getClass().getSimpleName()));\n}","typeGuard":"boolean isList(Object v) { return v instanceof List; }","tryCatchPattern":null,"preventionTips":["In YAML use explicit list syntax ([a, b] or dash items) for list-typed keys.","When building conf in code, always use Arrays.asList / Collections.singletonList.","Run ConfigValidation on the final conf before submitting."],"tags":["config-validation","type-mismatch","storm"],"backgroundTag":"type-mismatch","analyzedSha":"cdb116e942666973bc4eaa0df098d5bab82739e7","analyzedAt":"2026-09-12T14:30:00.714Z","contentChangedAt":"2026-09-12T14:30:00.714Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}