apache/beam · error · IllegalStateException

Unknown type of %s %s

Error message

Unknown type of %s %s

What it means

Thrown by GreedyStageFuser.forGrpcPortRead when a consumer PCollection's PCollectionFusibility is an unrecognized/unsupported enum value. The fuser only handles the fusibility cases it knows; an unknown value means the enum or graph analysis produced something outside the expected set.

Source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/graph/GreedyStageFuser.java:127

      PCollectionFusibility fusibility =
          canFuse(pipeline, candidate, environment, fusedCollections);
      switch (fusibility) {
        case MATERIALIZE:
          materializedPCollections.add(candidate);
          break;
        case FUSE:
          // All of the consumers of the candidate PCollection can be fused into this stage. Do so.
          fusedCollections.add(candidate);
          fusedTransforms.addAll(pipeline.getPerElementConsumers(candidate));
          for (PipelineNode.PTransformNode consumer : pipeline.getPerElementConsumers(candidate)) {
            // The outputs of every transform fused into this stage must be either materialized or
            // themselves fused away, so add them to the set of candidates.
            fusionCandidates.addAll(pipeline.getOutputPCollections(consumer));
            sideInputs.addAll(pipeline.getSideInputs(consumer));
          }
          break;
        default:
          throw new IllegalStateException(
              String.format(
                  "Unknown type of %s %s",
                  PCollectionFusibility.class.getSimpleName(), fusibility));
      }
    }

    return ImmutableExecutableStage.ofFullComponents(
        pipeline.getComponents(),
        environment,
        inputPCollection,
        sideInputs,
        userStates,
        timers,
        fusedTransforms.build(),
        materializedPCollections,
        ExecutableStage.DEFAULT_WIRE_CODER_SETTINGS);
  }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Use consistent Beam versions for all pipeline-construction and fusion components.
  2. Add the new PCollectionFusibility case to the switch in GreedyStageFuser.forGrpcPortRead if you introduced one.
  3. Check for duplicate/shaded beam-runner jars supplying an older enum.
  4. Log the fusibility value to identify which enum constant is unhandled.

Example fix

// before
switch (fusibility) { case FUSIBLE: ...; case NOT_FUSABLE: ...; }
// after
switch (fusibility) { case FUSIBLE: ...; case NOT_FUSABLE: ...; case NEW_MEMBER: /* handle */ break; }
Defensive patterns

Strategy: try-catch

Validate before calling

PCollectionFusibility f = pipeline.getPCollectionFusibility(consumer);
if (f != PCollectionFusibility.FUSIBLE && f != PCollectionFusibility.NOT_FUSABLE) throw new IllegalStateException("Unhandled fusibility: " + f);

Type guard

boolean isHandled(PCollectionFusibility f) { return f == PCollectionFusibility.FUSIBLE || f == PCollectionFusibility.NOT_FUSABLE; }

Try / catch

try { stage = GreedyStageFuser.forGrpcPortRead(pipeline, read, fusedPcolls); } catch (IllegalStateException e) { log.error("Fusion hit unknown PCollectionFusibility", e); throw e; }

Prevention

When it happens

Trigger: Fusing an executable stage around a gRPC port read when pipeline.getPCollectionFusibility(consumer) returns an enum constant not covered by the switch — typically a new enum member from a newer Beam version, or a corrupted/unmapped fusibility result.

Common situations: Version skew between the graph-building code and the fusibility analysis; custom runner plugins that extend fusibility semantics; stale shaded copies of Beam internals.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/ca209094f93e9368. Report an issue: GitHub.