{"record":{"id":"9ac1fbc1ede1f05e","repo":"apache/hadoop","slug":"unknown-checksum-type-in-algorithm","errorCode":null,"errorMessage":"Unknown checksum type in ${algorithm}","messagePattern":"Unknown checksum type in (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/MD5MD5CRC32FileChecksum.java","lineNumber":74,"sourceCode":"    this.crcPerBlock = crcPerBlock;\n    this.md5 = md5;\n  }\n\n  @Override\n  public String getAlgorithmName() {\n    return \"MD5-of-\" + crcPerBlock + \"MD5-of-\" + bytesPerCRC +\n        getCrcType().name();\n  }\n\n  public static DataChecksum.Type getCrcTypeFromAlgorithmName(String algorithm)\n      throws IOException {\n    if (algorithm.endsWith(DataChecksum.Type.CRC32.name())) {\n      return DataChecksum.Type.CRC32;\n    } else if (algorithm.endsWith(DataChecksum.Type.CRC32C.name())) {\n      return DataChecksum.Type.CRC32C;\n    }\n\n    throw new IOException(\"Unknown checksum type in \" + algorithm);\n  }\n\n  @Override\n  public int getLength() {return LENGTH;}\n\n  @Override\n  public byte[] getBytes() {\n    return WritableUtils.toByteArray(this);\n  }\n\n  /**\n   * returns the CRC type.\n   * @return data check sum type.\n   */\n  public DataChecksum.Type getCrcType() {\n    // default to the one that is understood by all releases.\n    return DataChecksum.Type.CRC32;\n  }","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/MD5MD5CRC32FileChecksum.java#L56-L92","documentation":"MD5MD5CRC32FileChecksum.getCrcTypeFromAlgorithmName() maps a checksum algorithm string (e.g. 'MD5-of-0MD5-of-512CRC32') to a DataChecksum.Type by suffix matching. Only CRC32 and CRC32C suffixes are recognized; any other algorithm name throws IOException.","triggerScenarios":"Feeding an algorithm name that does not end in CRC32 or CRC32C — typically parsed from a file checksum header written by a different/newer Hadoop (new checksum type), a malformed/hand-built algorithm string, or corrupted checksum metadata.","commonSituations":"Version skew between writer and reader clusters, mixed-version rolling upgrades, custom or experimental checksum types, truncated algorithm strings.","solutions":["Align client and cluster Hadoop versions so both sides know the checksum type","Regenerate/recompute the checksum with CRC32 or CRC32C and rewrite the sidecar metadata","Pre-validate the algorithm string (endsWith CRC32/CRC32C) and branch to an explicit 'unsupported checksum' path"],"exampleFix":"// before\nDataChecksum.Type t = MD5MD5CRC32FileChecksum.getCrcTypeFromAlgorithmName(alg);\n// after\nif (!alg.endsWith(DataChecksum.Type.CRC32.name()) && !alg.endsWith(DataChecksum.Type.CRC32C.name())) {\n  throw new IOException(\"Unsupported checksum algorithm: \" + alg);\n}\nDataChecksum.Type t = MD5MD5CRC32FileChecksum.getCrcTypeFromAlgorithmName(alg);","handlingStrategy":"try-catch","validationCode":"if (algorithm == null\n    || (!algorithm.endsWith(DataChecksum.Type.CRC32.name())\n        && !algorithm.endsWith(DataChecksum.Type.CRC32C.name()))) {\n  throw new IOException(\"Unsupported checksum algorithm: \" + algorithm);\n}","typeGuard":null,"tryCatchPattern":"try {\n  DataChecksum.Type t = MD5MD5CRC32FileChecksum.getCrcTypeFromAlgorithmName(alg);\n} catch (IOException e) {\n  /* unknown checksum type: skip comparison or upgrade for compatibility */\n}","preventionTips":["Pin matching Hadoop versions across writer and reader","Reject unknown algorithm names early at ingest","Never hand-build checksum algorithm strings"],"tags":["checksum","algorithm","version-mismatch","crc"],"backgroundTag":"unknown-checksum-algorithm","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}