{"record":{"id":"5593f90f00e98f64","repo":"nathanmarz/storm","slug":"could-not-find-component-with-id-id","errorCode":null,"errorMessage":"Could not find component with id ${id}","messagePattern":"Could not find component with id (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/backtype/storm/utils/Utils.java","lineNumber":285,"sourceCode":"    public static <K, V> Map<V, K> reverseMap(Map<K, V> map) {\n        Map<V, K> ret = new HashMap<V, K>();\n        for(K key: map.keySet()) {\n            ret.put(map.get(key), key);\n        }\n        return ret;\n    }\n    \n    public static ComponentCommon getComponentCommon(StormTopology topology, String id) {\n        if(topology.get_spouts().containsKey(id)) {\n            return topology.get_spouts().get(id).get_common();\n        }\n        if(topology.get_bolts().containsKey(id)) {\n            return topology.get_bolts().get(id).get_common();\n        }\n        if(topology.get_state_spouts().containsKey(id)) {\n            return topology.get_state_spouts().get(id).get_common();\n        }\n        throw new IllegalArgumentException(\"Could not find component with id \" + id);\n    }\n    \n    public static Integer getInt(Object o) {\n        if(o instanceof Long) {\n            return ((Long) o ).intValue();\n        } else if (o instanceof Integer) {\n            return (Integer) o;\n        } else if (o instanceof Short) {\n            return ((Short) o).intValue();\n        } else {\n            throw new IllegalArgumentException(\"Don't know how to convert \" + o + \" + to int\");\n        }\n    }\n    \n    public static long secureRandomLong() {\n        return UUID.randomUUID().getLeastSignificantBits();\n    }\n    ","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/backtype/storm/utils/Utils.java#L267-L303","documentation":"Storm's Utils.getComponentCommon looks up a component's Common struct by id across spouts, bolts, and state spouts of a topology. If the id matches none of those maps, it throws IllegalArgumentException. This means the topology being inspected has no component registered under that id.","triggerScenarios":"Calling getComponentCommon(topology, id) with an id that is not a key of topology.spouts, topology.bolts, or topology.state_spouts — e.g. a stale/mistyped component id, an id from a different topology, or an acker/system component id ('__acker', '__systemmetricconsumer') looked up in a user-submitted topology that excludes system components.","commonSituations":"Custom schedulers, metrics consumers, or topology validators that iterate over tasks/streams and assume every referenced component id exists; ids like '__acker' not present in Thrift-generated topology when system topologies are not used; typos in config 'topology.*' component references.","solutions":["Print/verify the component id and enumerate the topology's actual component ids (topology.get_bolts().keySet(), get_spouts(), get_state_spouts()) before lookup.","If the id is a Storm system component (__acker, __metrics etc.), look it up on the system topology (or skip it) rather than the user topology.","Fix the source of the id (typo, wrong topology object passed in, stale serialized topology).","Wrap the call in try-catch (IllegalArgumentException) when probing for optional components."],"exampleFix":"// before\nCommon common = Utils.getComponentCommon(topology, compId);\n// after\nMap<String, Bolt> bolts = topology.get_bolts();\nif (bolts.containsKey(compId)) {\n    Common common = Utils.getComponentCommon(topology, compId);\n} else {\n    LOG.warn(\"Skipping unknown component id: \" + compId);\n}","handlingStrategy":"validation","validationCode":"Set<String> known = new HashSet<>();\nknown.addAll(topology.get_bolts().keySet());\nknown.addAll(topology.get_spouts().keySet());\nknown.addAll(topology.get_state_spouts().keySet());\nif (!known.contains(componentId)) throw new IllegalStateException(\"Unknown component: \" + componentId);","typeGuard":"boolean componentExists(StormTopology topo, String id) {\n    return topo.get_bolts().containsKey(id)\n        || topo.get_spouts().containsKey(id)\n        || topo.get_state_spouts().containsKey(id);\n}","tryCatchPattern":"try {\n    Common c = Utils.getComponentCommon(topology, id);\n} catch (IllegalArgumentException e) {\n    LOG.warn(\"Component not found: \" + id, e);\n    // skip or use default\n}","preventionTips":["Always enumerate topology component ids from the topology object itself, never from cached/foreign lists","Treat __acker/__system ids as system components and skip them when inspecting user topologies","Validate user config component references at topology submit time"],"tags":["java","topology","component-lookup","storm"],"backgroundTag":"resource-not-found","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"}