pentaho/pentaho-kettle · error · KettleException

CheckSum.Error.UnknownChecksumType

CheckSum.Error.UnknownChecksumType

Error message

CheckSum.Error.UnknownChecksumType

What it means

The CheckSum step received a checksum type value that initializeChecksumCalculator's switch does not handle (only MD5, SHA-1, Adler32, CRC32 are supported), so the default branch throws this KettleException naming the type. This indicates stale or corrupted step metadata, since the dialog normally only offers valid types.

Solutions

  1. Open the CheckSum step dialog and re-select a supported checksum type (MD5, SHA-1, CRC32, Adler32).
  2. If using Metadata Injection, only inject values from CheckSumMeta.TYPE_* constants.
  3. Recreate the step if the .ktr was hand-edited or comes from an incompatible version.
  4. Check the numeric checksumtype value in the .ktr XML matches a documented constant.

Example fix

// before: injected value
meta.setCheckSumType( 99 );
// after
meta.setCheckSumType( CheckSumMeta.TYPE_CRC32 );
Defensive patterns

Strategy: type-guard

Validate before calling

// Only pass valid constants when injecting metadata
int type = meta.getCheckSumType();
boolean valid = type == CheckSumMeta.TYPE_MD5 || type == CheckSumMeta.TYPE_SHA1
    || type == CheckSumMeta.TYPE_CRC32 || type == CheckSumMeta.TYPE_ADLER32;
if ( !valid ) { throw new IllegalArgumentException( "Invalid checksum type: " + type ); }

Type guard

boolean isValidChecksumType( int t ) {
  return t == CheckSumMeta.TYPE_MD5 || t == CheckSumMeta.TYPE_SHA1
      || t == CheckSumMeta.TYPE_CRC32 || t == CheckSumMeta.TYPE_ADLER32;
}

Prevention

When it happens

Trigger: In initializeChecksumCalculator (called from processRow): meta.getCheckSumType() returns a value outside the supported CheckSumMeta.TYPE_* constants, falling through to the default case.

Common situations: Step metadata loaded from a file produced by a different plugin version with extra/renamed types; metadata injected programmatically with an invalid integer type; hand-edited .ktr changing the checksumtype value.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/1b4c28cb9aa3d64b. Report an issue: GitHub.

Appendix: source

Thrown at plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/checksum/CheckSum.java:188

  }

  private void initializeChecksumCalculator() throws KettleException {
    try {
      switch ( meta.getCheckSumType() ) {
        case CheckSumMeta.TYPE_MD5:
        case CheckSumMeta.TYPE_SHA1:
        case CheckSumMeta.TYPE_SHA256:
          data.checksumCalculator =
              new DigestChecksumCalculator( MessageDigest.getInstance( meta.getCheckSumType() ) );
          break;
        case CheckSumMeta.TYPE_ADLER32:
          data.checksumCalculator = new ChecksumChecksumCalculator( new Adler32() );
          break;
        case CheckSumMeta.TYPE_CRC32:
          data.checksumCalculator = new ChecksumChecksumCalculator( new CRC32() );
          break;
        default:
          throw new KettleException(
          BaseMessages.getString( PKG, "CheckSum.Error.UnknownChecksumType", meta.getCheckSumType() ) );
      }
    } catch ( KettleException e ) {
      // Rethrow it
      throw e;
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( PKG, "CheckSum.Error.Digest" ), e );
    }
  }

  private void initializeFieldConverters( RowMetaInterface inputRowMeta, int[] fieldIndexMapping ) throws KettleException {
    data.fieldConverters = new FieldToBytesConverter[ fieldIndexMapping.length ];
    for ( int i = 0; i < fieldIndexMapping.length; i++ ) {
      switch ( meta.getEvaluationMethod() ) {
        case CheckSumMeta.EVALUATION_METHOD_BYTES:
          data.fieldConverters[ i ] = new BytesToBytesConverter( inputRowMeta, fieldIndexMapping[ i ] );
          break;
        case CheckSumMeta.EVALUATION_METHOD_PENTAHO_STRINGS:

View on GitHub (pinned to f3058517a1)