nathanmarz/storm · error · RuntimeException

Cannot have one group have fixed parallelism of two…

Error message

Cannot have one group have fixed parallelism of two different values

What it means

getFixedParallelism derives a group's fixed parallelism from the requiredNumPartitions of state specs in its nodes. If two different states in the same group require different partition counts, a single parallelism cannot satisfy both, so this RuntimeException is thrown during build.

Solutions

  1. Set explicit, equal requiredNumPartitions on all state specs in the group
  2. Add explicit parallelismHints and reorder/partition so the states are not in the same equivalence group
  3. Give each state its own branch partitioned independently instead of sharing a group

Example fix

// before
HBaseState.Options o1 = new HBaseState.Options().setNumPartitions(4);
HBaseState.Options o2 = new HBaseState.Options().setNumPartitions(8); // same group
// after
HBaseState.Options o2 = new HBaseState.Options().setNumPartitions(4); // match required partitions
Defensive patterns

Strategy: validation

Validate before calling

// all states in a shared group must declare the same requiredNumPartitions
Set<Integer> reqs = states.stream().map(s -> s.getRequiredNumPartitions()).collect(Collectors.toSet());
if (reqs.size() > 1) throw new IllegalArgumentException("All co-grouped states must require the same partitions: " + reqs);

Try / catch

try {
    topology.build();
} catch (RuntimeException e) {
    if (e.getMessage().contains("fixed parallelism of two different values")) {
        throw new IllegalStateException("Unify requiredNumPartitions across states in the same group", e);
    } throw e;
}

Prevention

When it happens

Trigger: A TridentTopology with multiple persistentAggregates/states (e.g. two HBase or Redis map states with different requiredNumPartitions) whose nodes fall into the same parallelism-equivalence group.

Common situations: Several persistentAggregates downstream of a shared partitionBy/groupBy without explicit parallelismHints; migrating one state backend and adding a second with different partition requirements; merging two topology fragments into one TridentTopology.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at storm-core/src/jvm/storm/trident/TridentTopology.java:655

    
    private static Map getSpoutComponentConfig(Object spout) {
        if(spout instanceof IRichSpout) {
            return ((IRichSpout) spout).getComponentConfiguration();
        } else if (spout instanceof IBatchSpout) {
            return ((IBatchSpout) spout).getComponentConfiguration();
        } else {
            return ((ITridentSpout) spout).getComponentConfiguration();
        }
    }
    
    private static Integer getFixedParallelism(Set<Group> groups) {
        Integer ret = null;
        for(Group g: groups) {
            for(Node n: g.nodes) {
                if(n.stateInfo != null && n.stateInfo.spec.requiredNumPartitions!=null) {
                    int reqPartitions = n.stateInfo.spec.requiredNumPartitions;
                    if(ret!=null && ret!=reqPartitions) {
                        throw new RuntimeException("Cannot have one group have fixed parallelism of two different values");
                    }
                    ret = reqPartitions;
                }
            }
        }
        return ret;
    }
    
    private static boolean isIdentityPartition(PartitionNode n) {
        Grouping g = n.thriftGrouping;
        if(g.is_set_custom_serialized()) {
            CustomStreamGrouping csg = (CustomStreamGrouping) Utils.deserialize(g.get_custom_serialized());
            return csg instanceof IdentityGrouping;
        }
        return false;
    }
    
    private static void addEdge(DirectedGraph g, Object source, Object target, int index) {

View on GitHub (pinned to cdb116e942)