nathanmarz/storm · error · IllegalArgumentException

Could not find component common for

Error message

Could not find component common for ${componentId}

What it means

ThriftTopologyUtils.getComponentCommon looks up the storm.thrift component-common (StormTopology._fields_to_component_common) entry for a given component id inside a Thrift topology. It throws IllegalArgumentException when the component id is not a key in the topology's component map. This indicates the caller passed a component id that does not exist in the given topology.

Solutions

  1. Verify the componentId exactly matches a component name defined in the topology (spout/bolt declarations) — check spelling and case.
  2. Regenerate or re-submit the topology so its _fields_to_component_common map is populated, instead of using a stale deserialized/modified Thrift topology object.
  3. If building topologies programmatically, ensure every id referenced by wiring (fieldsGrouping, shuffleGrouping targets) is the same id used at declaration time.
  4. Guard calls by checking topology.get_bolts()/get_spouts() for the id before calling getComponentCommon.

Example fix

// before
ComponentCommon common = ThriftTopologyUtils.getComponentCommon(topology, componentId);
// after
Map<String, Bolt> bolts = topology.get_bolts();
if (!bolts.containsKey(componentId)) {
    throw new IllegalArgumentException("Unknown component: " + componentId);
}
ComponentCommon common = ThriftTopologyUtils.getComponentCommon(topology, componentId);
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = topology.get_bolts().containsKey(componentId)
    || topology.get_spouts().containsKey(componentId)
    || (topology.get_state_spouts() != null && topology.get_state_spouts().containsKey(componentId));
if (!exists) throw new IllegalArgumentException("component not in topology: " + componentId);

Type guard

boolean isKnownComponent(StormTopology topo, String id) {
    return topo.get_bolts().containsKey(id) || topo.get_spouts().containsKey(id);
}

Try / catch

try {
    common = ThriftTopologyUtils.getComponentCommon(topology, componentId);
} catch (IllegalArgumentException e) {
    LOG.warn("Unknown component id " + componentId + ", skipping: " + e.getMessage());
    common = null;
}

Prevention

When it happens

Trigger: Calling getComponentCommon(topology, componentId) with a componentId absent from the topology's spouts/bolts/state_spouts maps — typically a typo, stale id, or querying a different topology instance than the one that defined the component.

Common situations: Storm internals or custom metric/coordination code resolving stream->component->common mappings after topology repartitioning or renaming; YAML-driven topology definitions where a 'to:' reference points at a nonexistent component name; code written against a modified topology graph that removed a component.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of nathanmarz/storm@cdb116e942 (2026-09-12). Data as JSON: /api/errors/6a01af553613a102. Report an issue: GitHub.

Appendix: source

Thrown at storm-core/src/jvm/backtype/storm/utils/ThriftTopologyUtils.java:56

    public static ComponentCommon getComponentCommon(StormTopology topology, String componentId) {
        for(StormTopology._Fields f: StormTopology.metaDataMap.keySet()) {
            Map<String, Object> componentMap = (Map<String, Object>) topology.getFieldValue(f);
            if(componentMap.containsKey(componentId)) {
                Object component = componentMap.get(componentId);
                if(component instanceof Bolt) {
                    return ((Bolt) component).get_common();
                }
                if(component instanceof SpoutSpec) {
                    return ((SpoutSpec) component).get_common();
                }
                if(component instanceof StateSpoutSpec) {
                    return ((StateSpoutSpec) component).get_common();
                }
                throw new RuntimeException("Unreachable code! No get_common conversion for component " + component);
            }
        }
        throw new IllegalArgumentException("Could not find component common for " + componentId);
    }
}

View on GitHub (pinned to cdb116e942)