nathanmarz/storm · error · IllegalArgumentException

Could not find component with id

Error message

Could not find component with id ${id}

What it means

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.

Solutions

  1. Print/verify the component id and enumerate the topology's actual component ids (topology.get_bolts().keySet(), get_spouts(), get_state_spouts()) before lookup.
  2. 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.
  3. Fix the source of the id (typo, wrong topology object passed in, stale serialized topology).
  4. Wrap the call in try-catch (IllegalArgumentException) when probing for optional components.

Example fix

// before
Common common = Utils.getComponentCommon(topology, compId);
// after
Map<String, Bolt> bolts = topology.get_bolts();
if (bolts.containsKey(compId)) {
    Common common = Utils.getComponentCommon(topology, compId);
} else {
    LOG.warn("Skipping unknown component id: " + compId);
}
Defensive patterns

Strategy: validation

Validate before calling

Set<String> known = new HashSet<>();
known.addAll(topology.get_bolts().keySet());
known.addAll(topology.get_spouts().keySet());
known.addAll(topology.get_state_spouts().keySet());
if (!known.contains(componentId)) throw new IllegalStateException("Unknown component: " + componentId);

Type guard

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

Try / catch

try {
    Common c = Utils.getComponentCommon(topology, id);
} catch (IllegalArgumentException e) {
    LOG.warn("Component not found: " + id, e);
    // skip or use default
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at storm-core/src/jvm/backtype/storm/utils/Utils.java:285

    public static <K, V> Map<V, K> reverseMap(Map<K, V> map) {
        Map<V, K> ret = new HashMap<V, K>();
        for(K key: map.keySet()) {
            ret.put(map.get(key), key);
        }
        return ret;
    }
    
    public static ComponentCommon getComponentCommon(StormTopology topology, String id) {
        if(topology.get_spouts().containsKey(id)) {
            return topology.get_spouts().get(id).get_common();
        }
        if(topology.get_bolts().containsKey(id)) {
            return topology.get_bolts().get(id).get_common();
        }
        if(topology.get_state_spouts().containsKey(id)) {
            return topology.get_state_spouts().get(id).get_common();
        }
        throw new IllegalArgumentException("Could not find component with id " + id);
    }
    
    public static Integer getInt(Object o) {
        if(o instanceof Long) {
            return ((Long) o ).intValue();
        } else if (o instanceof Integer) {
            return (Integer) o;
        } else if (o instanceof Short) {
            return ((Short) o).intValue();
        } else {
            throw new IllegalArgumentException("Don't know how to convert " + o + " + to int");
        }
    }
    
    public static long secureRandomLong() {
        return UUID.randomUUID().getLeastSignificantBits();
    }
    

View on GitHub (pinned to cdb116e942)