{"record":{"id":"3271e047fac12e56","repo":"apache/beam","slug":"codecstr-is-not-supported","errorCode":null,"errorMessage":"${codecStr} is not supported","messagePattern":"(.+?) is not supported","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/io/SerializableAvroCodecFactory.java","lineNumber":110,"sourceCode":"    Matcher deflateMatcher = deflatePattern.matcher(codecStr);\n    if (deflateMatcher.find()) {\n      codecFactory = CodecFactory.deflateCodec(Integer.parseInt(deflateMatcher.group(\"level\")));\n      return;\n    }\n\n    Matcher xzMatcher = xzPattern.matcher(codecStr);\n    if (xzMatcher.find()) {\n      codecFactory = CodecFactory.xzCodec(Integer.parseInt(xzMatcher.group(\"level\")));\n      return;\n    }\n\n    Matcher zstdMatcher = zstdPattern.matcher(codecStr);\n    if (zstdMatcher.find()) {\n      codecFactory = CodecFactory.zstandardCodec(Integer.parseInt(zstdMatcher.group(\"level\")));\n      return;\n    }\n\n    throw new IllegalStateException(codecStr + \" is not supported\");\n  }\n\n  public CodecFactory getCodec() {\n    return codecFactory;\n  }\n\n  @Override\n  public String toString() {\n    checkNotNull(codecFactory, \"Inner CodecFactory is null, please use non default constructor\");\n    return codecFactory.toString();\n  }\n}\n","sourceCodeStart":92,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/io/SerializableAvroCodecFactory.java#L92-L123","documentation":"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.","triggerScenarios":"Deserializing a SerializableAvroCodecFactory (readExternal) whose codecStr came from a different Beam version supporting codecs this version doesn't recognize.","commonSituations":"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.","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"],"exampleFix":"// before (newer Beam)\n.withCodec(CodecFactory.zstandardCodec(3))\n// after (older Beam without zstd)\n.withCodec(CodecFactory.snappyCodec())","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { in.readObject(); } catch (IllegalStateException e) { codecFactory = CodecFactory.snappyCodec(); }","preventionTips":["Use the same Beam version on all pipeline environments","Prefer widely supported codecs (snappy, deflate) for portability","Avoid persisting SerializableAvroCodecFactory instances across upgrades"],"tags":["avro","codec","serialization"],"backgroundTag":"unsupported-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}