apache/beam · error · IllegalStateException
Unknown type
Error message
Unknown type
What it means
ManagedChannelFactory.forDescriptor switches over the ApiServiceDescriptor's enum method type to build a gRPC channel. Hitting the default branch means the descriptor carried an enum value this Beam version does not recognize, so channel creation cannot proceed and an IllegalStateException is thrown.
Solutions
- Align Beam versions between the runner/job server and SDK harness so channel type enums match.
- Check the ApiServiceDescriptor.getUrl() and its type field for accidental custom/incorrect values.
- Upgrade the SDK containing ManagedChannelFactory to a version supporting the descriptor's channel type.
Example fix
// before
ApiServiceDescriptor descriptor = ApiServiceDescriptor.newBuilder()
.setUrl("localhost:0")
.setChannelType("unsupported_future_type") // unknown enum
.build();
// after
ApiServiceDescriptor descriptor = ApiServiceDescriptor.newBuilder()
.setUrl("localhost:0") // rely on default/known channel type
.build(); Defensive patterns
Strategy: validation
Validate before calling
if (!EnumSet.allOf(ManagedChannelFactory.ChannelType.class)
.contains(descriptor.getChannelType()))
throw new IllegalArgumentException("unsupported channel type: " + descriptor.getChannelType()); Try / catch
try { channel = ManagedChannelFactory.forDescriptor(desc); } catch (IllegalStateException e) { /* version skew: align Beam versions */ throw e; } Prevention
- Pin identical Beam versions across runner, job server, and SDK harness images
- Avoid hand-crafting ApiServiceDescriptor channel type fields
- Test cross-language pipelines with matching container tags
When it happens
Trigger: An ApiServiceDescriptor from a newer/older Beam or runner specifies a channel type enum absent from this client's ManagedChannelFactory.ChannelType (only LEGACY/remote and IN_PROCESS are handled).
Common situations: Version skew between the job server/expansion service and the SDK harness; custom descriptors built with the wrong enum; mixing Beam versions in container images.
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
- Unknown ValueKind number
- All workers communicate through gRPC should have worker_id…
- Cannot convert unknown
- Cannot convert unknown
- Cannot interpret a request received over control channel…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/6d44c4c7f001d3c7.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/fn/channel/ManagedChannelFactory.java:83
channelBuilder =
NettyChannelBuilder.forAddress(address)
.channelType(
address instanceof DomainSocketAddress
? EpollDomainSocketChannel.class
: EpollSocketChannel.class)
.eventLoopGroup(new EpollEventLoopGroup());
break;
case DEFAULT:
channelBuilder = ManagedChannelBuilder.forTarget(apiServiceDescriptor.getUrl());
break;
case IN_PROCESS:
channelBuilder = InProcessChannelBuilder.forName(apiServiceDescriptor.getUrl());
break;
default:
throw new IllegalStateException("Unknown type " + type);
}
channelBuilder =
channelBuilder
.usePlaintext()
// Set the message size to max value here. The actual size is governed by the
// buffer size in the layers above.
.maxInboundMessageSize(Integer.MAX_VALUE)
// Disable automatic retries as it introduces complexity and we send long-lived
// rpcs which will exceed the per-rpc retry request buffer and not be retried
// anyway. See
// https://github.com/grpc/proposal/blob/master/A6-client-retries.md#when-retries-are-valid
.disableRetry()
.intercept(interceptors);
if (directExecutor) {
channelBuilder = channelBuilder.directExecutor();
}
return channelBuilder.build();View on GitHub (pinned to 12126d8942)