apache/beam · error · IllegalStateException
is not supported
Error message
${codecStr} is not supported What it means
SerializableAvroCodecFactory reconstructs an Avro CodecFactory from its serialized string form by pattern-matching known codecs (null, deflate, snappy, zstd with level). If the string matches none of the known patterns it throws IllegalStateException.
Solutions
- Use the same (or newer) Beam version on both sides of serialization
- Choose a codec supported by all Beam versions in use, e.g. snappy or deflate
- Regenerate the serialized object with the older runtime's codec factory
Example fix
// before (newer Beam) .withCodec(CodecFactory.zstandardCodec(3)) // after (older Beam without zstd) .withCodec(CodecFactory.snappyCodec())
Defensive patterns
Strategy: try-catch
Try / catch
try { in.readObject(); } catch (IllegalStateException e) { codecFactory = CodecFactory.snappyCodec(); } Prevention
- Use the same Beam version on all pipeline environments
- Prefer widely supported codecs (snappy, deflate) for portability
- Avoid persisting SerializableAvroCodecFactory instances across upgrades
When it happens
Trigger: Deserializing a SerializableAvroCodecFactory (readExternal) whose codecStr came from a different Beam version supporting codecs this version doesn't recognize.
Common situations: Pipeline written with a newer Beam supporting e.g. zstandard levels, then deserialized/run with an older Beam lacking that codec pattern; or a manually corrupted codec string.
Related errors
- Could not encode avro from given row
- Error writing row to Avro
- Unknown mode for AvroSource
- A schema must be provided when writing to BigQuery using…
- An explicit schema is required to write non-schema'd…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/3271e047fac12e56.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/io/SerializableAvroCodecFactory.java:110
Matcher deflateMatcher = deflatePattern.matcher(codecStr);
if (deflateMatcher.find()) {
codecFactory = CodecFactory.deflateCodec(Integer.parseInt(deflateMatcher.group("level")));
return;
}
Matcher xzMatcher = xzPattern.matcher(codecStr);
if (xzMatcher.find()) {
codecFactory = CodecFactory.xzCodec(Integer.parseInt(xzMatcher.group("level")));
return;
}
Matcher zstdMatcher = zstdPattern.matcher(codecStr);
if (zstdMatcher.find()) {
codecFactory = CodecFactory.zstandardCodec(Integer.parseInt(zstdMatcher.group("level")));
return;
}
throw new IllegalStateException(codecStr + " is not supported");
}
public CodecFactory getCodec() {
return codecFactory;
}
@Override
public String toString() {
checkNotNull(codecFactory, "Inner CodecFactory is null, please use non default constructor");
return codecFactory.toString();
}
}
View on GitHub (pinned to 12126d8942)