pentaho/pentaho-kettle · error · KettleValueException

: I don't know how to convert binary values to booleans.

Error message

 : I don't know how to convert binary values to booleans.

What it means

This KettleValueException is thrown by ValueMetaBase.getBoolean(Object) when the value metadata's type is TYPE_BINARY. PDI has no defined rule for converting a raw byte[] to a Boolean, so instead of guessing it fails fast with a message prefixed by the field's toString() (name/type details). It is a programming/metadata-definition error, not a runtime data-quality issue.

Solutions

  1. Change the field's value type to TYPE_BOOLEAN, TYPE_STRING, TYPE_INTEGER or TYPE_NUMBER before calling getBoolean (e.g. a 'Select values' / metadata edit step, or valueMeta.setValueType(ValueMetaInterface.TYPE_BOOLEAN) with an explicit conversion rule).
  2. Convert the binary data yourself first (e.g. convertBinaryStringToNativeType or a string parse of "Y"/"N", "true"/"false") then read as the matching type.
  3. Catch KettleValueException around the getBoolean call and handle the Binary field explicitly.

Example fix

// before
Boolean flag = valueMeta.getBoolean( rowData[i] ); // throws for TYPE_BINARY
// after
if ( valueMeta.getType() == ValueMetaInterface.TYPE_BINARY ) {
  valueMeta.setValueType( ValueMetaInterface.TYPE_STRING ); // then convert explicitly
}
Boolean flag = valueMeta.getBoolean( rowData[i] );
Defensive patterns

Strategy: type-guard

Validate before calling

if ( valueMeta.getType() == ValueMetaInterface.TYPE_BINARY ) {
  throw new IllegalArgumentException( "Field " + valueMeta.getName() + " is BINARY; cannot read as Boolean" );
}

Type guard

boolean readableAsBoolean( ValueMetaInterface vm ) {
  int t = vm.getType();
  return t == ValueMetaInterface.TYPE_BOOLEAN || t == ValueMetaInterface.TYPE_STRING
      || t == ValueMetaInterface.TYPE_INTEGER || t == ValueMetaInterface.TYPE_NUMBER
      || t == ValueMetaInterface.TYPE_BIGNUMBER;
}

Try / catch

try {
  Boolean b = valueMeta.getBoolean( row[i] );
} catch ( KettleValueException e ) {
  logError( "Cannot read " + valueMeta.getName() + " as boolean: " + e.getMessage() );
  // handle Binary field explicitly
}

Prevention

When it happens

Trigger: Calling getBoolean(object) (directly or via RowMeta.getBoolean/row-level getters) on a ValueMeta whose type was set to TYPE_BINARY, e.g. via new ValueMetaBinary(...), setValueType(ValueMetaInterface.TYPE_BINARY), or metadata read from a repository/ktr that declares the field as Binary.

Common situations: Reading CSV/database columns mapped as Binary then applying a Boolean output field in a transformation; custom plugin code calling row.getBoolean(index) without checking the field type; metadata imported from an older repository where the column was Binary.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java:2291

            return convertNumberToBoolean( (Double) index[( (Integer) object ).intValue()] );
          default:
            throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
        }
      case TYPE_BIGNUMBER:
        switch ( storageType ) {
          case STORAGE_TYPE_NORMAL:
            return convertBigNumberToBoolean( (BigDecimal) object );
          case STORAGE_TYPE_BINARY_STRING:
            return convertBigNumberToBoolean( (BigDecimal) convertBinaryStringToNativeType( (byte[]) object ) );
          case STORAGE_TYPE_INDEXED:
            return convertBigNumberToBoolean( (BigDecimal) index[( (Integer) object ).intValue()] );
          default:
            throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
        }
      case TYPE_DATE:
        throw new KettleValueException( toString() + " : I don't know how to convert date values to booleans." );
      case TYPE_BINARY:
        throw new KettleValueException( toString() + " : I don't know how to convert binary values to booleans." );
      case TYPE_SERIALIZABLE:
        throw new KettleValueException( toString() + " : I don't know how to convert serializable values to booleans." );
      default:
        throw new KettleValueException( toString() + " : Unknown type " + type + " specified." );
    }
  }

  @Override
  public Date getDate( Object object ) throws KettleValueException {
    if ( isNull( object ) ) {
      return null;
    }
    switch ( type ) {
      case TYPE_DATE:
        switch ( storageType ) {
          case STORAGE_TYPE_NORMAL:
            return (Date) object;
          case STORAGE_TYPE_BINARY_STRING:

View on GitHub (pinned to f3058517a1)