{"record":{"id":"f79460cf8cfdc5c4","repo":"apache/hadoop","slug":"failed-to-create-erasure-codec","errorCode":null,"errorMessage":"Failed to create erasure codec","messagePattern":"Failed to create erasure codec","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecUtil.java","lineNumber":246,"sourceCode":"    throw new IllegalArgumentException(\"Fail to create raw erasure \" +\n        \"decoder with given codec: \" + codecName);\n  }\n\n  private static ErasureCodec createCodec(Configuration conf,\n      String codecClassName, ErasureCodecOptions options) {\n    ErasureCodec codec = null;\n    try {\n      Class<? extends ErasureCodec> codecClass =\n              conf.getClassByName(codecClassName)\n              .asSubclass(ErasureCodec.class);\n      Constructor<? extends ErasureCodec> constructor\n          = codecClass.getConstructor(Configuration.class,\n          ErasureCodecOptions.class);\n      codec = constructor.newInstance(conf, options);\n    } catch (ClassNotFoundException | InstantiationException |\n            IllegalAccessException | NoSuchMethodException |\n            InvocationTargetException e) {\n      throw new RuntimeException(\"Failed to create erasure codec\", e);\n    }\n\n    if (codec == null) {\n      throw new RuntimeException(\"Failed to create erasure codec\");\n    }\n\n    return codec;\n  }\n\n  private static String getCodecClassName(Configuration conf, String codec) {\n    switch (codec) {\n    case ErasureCodeConstants.RS_CODEC_NAME:\n      return conf.get(\n          CodecUtil.IO_ERASURECODE_CODEC_RS_KEY,\n          CodecUtil.IO_ERASURECODE_CODEC_RS);\n    case ErasureCodeConstants.RS_LEGACY_CODEC_NAME:\n      //TODO:rs-legacy should be handled differently.\n      return conf.get(","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecUtil.java#L228-L264","documentation":"Error \"Failed to create erasure codec\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecUtil.java:246 when the library encounters an invalid state.","commonSituations":"Occurs when the erasure codec factory fails to instantiate the configured codec class. Check the codec class name in configuration and that it is on the classpath.","solutions":["Review the codec configuration (codec name, numDataUnits, numParityUnits, coder list) for invalid values.","Check the nested cause exception for the underlying factory failure and fix the reported parameter."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}