{"record":{"id":"d51a7387ab19076f","repo":"apache/hadoop","slug":"encoded-type-converted-to-valid-component-type","errorCode":null,"errorMessage":"Encoded type {} converted to valid component type {} but no encoding is implemented for this type.","messagePattern":"Encoded type (.+?) converted to valid component type (.+?) but no encoding is implemented for this type\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/ArrayPrimitiveWritable.java","lineNumber":247,"sourceCode":"    // do the inner loop.  Walk the decision tree only once.\n    if (componentType == Boolean.TYPE) {             // boolean\n      readBooleanArray(in);\n    } else if (componentType == Character.TYPE) {    // char\n      readCharArray(in);\n    } else if (componentType == Byte.TYPE) {         // byte\n      readByteArray(in);\n    } else if (componentType == Short.TYPE) {        // short\n      readShortArray(in);\n    } else if (componentType == Integer.TYPE) {      // int\n      readIntArray(in);\n    } else if (componentType == Long.TYPE) {         // long\n      readLongArray(in);\n    } else if (componentType == Float.TYPE) {        // float\n      readFloatArray(in);\n    } else if (componentType == Double.TYPE) {       // double\n      readDoubleArray(in);\n    } else {\n      throw new IOException(\"Encoded type \" + className\n          + \" converted to valid component type \" + componentType.toString()\n          + \" but no encoding is implemented for this type.\");\n    }\n  }\n  \n  //For efficient implementation, there's no way around\n  //the following massive code duplication.\n  \n  private void writeBooleanArray(DataOutput out) throws IOException {\n    boolean[] v = (boolean[]) value;\n    for (int i = 0; i < length; i++)\n      out.writeBoolean(v[i]);\n  }\n  \n  private void writeCharArray(DataOutput out) throws IOException {\n    char[] v = (char[]) value;\n    for (int i = 0; i < length; i++)\n      out.writeChar(v[i]);","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/ArrayPrimitiveWritable.java#L229-L265","documentation":"The tail else of readFields()'s dispatch chain: the component type name resolved to a class in PRIMITIVE_NAMES (so getPrimitiveClass returned non-null) but none of the eight read branches matched. Since PRIMITIVE_NAMES contains exactly the eight handled primitives, this is a defensive, effectively unreachable internal-consistency check — it can only fire if a fork adds a name to the map without a corresponding readXxxArray branch, or state is mutated abnormally.","triggerScenarios":"A modified/forked ArrayPrimitiveWritable where PRIMITIVE_NAMES and the read dispatch chain are out of sync; reflection-assigned componentType. Not reachable in stock Hadoop.","commonSituations":"Vendored or patched hadoop-common where someone extended the supported primitive set incompletely.","solutions":["If you maintain a fork that adds a primitive, add both the map entry and the matching readXxxArray branch.","Otherwise, treat this as evidence of tampered internals or a classpath mix of Hadoop versions — align hadoop-common jars across the cluster."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  w.readFields(in);\n} catch (IOException e) {\n  LOG.error(\"Read dispatch failed for \" + w.getComponentType(), e);\n  throw e;\n}","preventionTips":["In forks, keep PRIMITIVE_NAMES and the read/write dispatch chains in sync when adding types.","Pin one hadoop-common version across the classpath to avoid mixed implementations."],"tags":["hadoop","serialization","invariant-violation","defensive-check","deserialization"],"backgroundTag":"unsupported-type-encoding","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}