pentaho/pentaho-kettle · error · KettleValueException

: Unknown type " + type + " specified.

Error message

 : Unknown type " + type + " specified.

What it means

The final default branch of getTimestamp() throws this KettleValueException when the field's declared type constant matches none of the handled cases (TYPE_DATE/TIMESTAMP, TYPE_STRING, TYPE_NUMBER, TYPE_INTEGER, TYPE_BIGNUMBER, TYPE_BOOLEAN, TYPE_BINARY, TYPE_SERIALIZABLE). It means the metadata's type code is unknown or corrupted relative to the ValueMeta types this class recognizes.

Solutions

  1. Print valueMeta.getType() and compare against ValueMetaInterface.TYPE_* constants; set a valid type with meta.setType(...) before conversion.
  2. Upgrade/align the PDI core and plugin versions so type constants match the serialization format of your transformations.
  3. Re-save the transformation with the current PDI version to normalize type codes.
  4. If the value actually is a timestamp, use TYPE_TIMESTAMP (or TYPE_DATE) metadata so the direct (Timestamp) object path is taken.

Example fix

// before
ValueMeta meta = new ValueMeta();
meta.setType( 999 ); // unknown type
Timestamp t = meta.getTimestamp( obj ); // throws Unknown type
// after
ValueMeta meta = new ValueMeta();
meta.setType( ValueMetaInterface.TYPE_TIMESTAMP );
Timestamp t = meta.getTimestamp( obj );
Defensive patterns

Strategy: validation

Validate before calling

int type = meta.getType();
if ( type < ValueMetaInterface.TYPE_NONE || type > ValueMetaInterface.TYPE_SERIALIZABLE ) {
  meta.setType( ValueMetaInterface.TYPE_TIMESTAMP );
}

Type guard

boolean hasKnownType( ValueMetaInterface meta ) {
  switch ( meta.getType() ) {
    case ValueMetaInterface.TYPE_TIMESTAMP:
    case ValueMetaInterface.TYPE_DATE:
    case ValueMetaInterface.TYPE_STRING:
    case ValueMetaInterface.TYPE_NUMBER:
    case ValueMetaInterface.TYPE_INTEGER:
    case ValueMetaInterface.TYPE_BIGNUMBER:
    case ValueMetaInterface.TYPE_BOOLEAN:
    case ValueMetaInterface.TYPE_BINARY:
    case ValueMetaInterface.TYPE_SERIALIZABLE:
      return true;
    default:
      return false;
  }
}

Try / catch

try {
  t = meta.getTimestamp( value );
} catch ( KettleValueException e ) {
  if ( e.getMessage().contains( "Unknown type" ) ) {
    meta.setType( ValueMetaInterface.TYPE_TIMESTAMP );
    t = meta.getTimestamp( value );
  } else { throw e; }
}

Prevention

When it happens

Trigger: getTimestamp(object) called with a value meta whose getType() returns an out-of-range or unrecognized type constant (e.g. a type code from a newer PDI version read by an older core, or a hand-set bogus value via setType(int)).

Common situations: Mixing PDI plugin/core versions where type constants diverged; metadata deserialized from an incompatible KTR; programmatic bugs writing arbitrary ints into the type field.

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/9d3fc6fd2e909f67. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaTimestamp.java:194

          case STORAGE_TYPE_NORMAL:
            return convertBigNumberToTimestamp( (BigDecimal) object );
          case STORAGE_TYPE_BINARY_STRING:
            return convertBigNumberToTimestamp( (BigDecimal) convertBinaryStringToNativeType( (byte[]) object ) );
          case STORAGE_TYPE_INDEXED:
            return convertBigNumberToTimestamp( (BigDecimal) index[ ( (Integer) object ).intValue() ] );
          default:
            throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
        }
      case TYPE_BOOLEAN:
        throw new KettleValueException( toString() + " : I don't know how to convert a boolean to a timestamp." );
      case TYPE_BINARY:
        throw new KettleValueException( toString() + " : I don't know how to convert a binary value to timestamp." );
      case TYPE_SERIALIZABLE:
        throw new KettleValueException( toString()
          + " : I don't know how to convert a serializable value to timestamp." );

      default:
        throw new KettleValueException( toString() + " : Unknown type " + type + " specified." );
    }
  }

  public int compare( Object data1, Object data2 ) throws KettleValueException {
    Timestamp timestamp1 = getTimestamp( data1 );
    Timestamp timestamp2 = getTimestamp( data2 );
    int cmp = 0;
    if ( timestamp1 == null ) {
      if ( timestamp2 == null ) {
        cmp = 0;
      } else {
        cmp = -1;
      }
    } else if ( timestamp2 == null ) {
      cmp = 1;
    } else {
      cmp = timestamp1.compareTo( timestamp2 );
    }

View on GitHub (pinned to f3058517a1)