pentaho/pentaho-kettle · error · KettleValueException

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

Error message

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

What it means

ValueMetaBase.getInteger() is asked to return a Long for a value whose metadata type is TYPE_BINARY. There is no defined conversion from raw byte[] binary data to an integer, so the method unconditionally throws KettleValueException. This is a deliberate refusal: the caller has an incompatible value type in the row for the requested conversion.

Solutions

  1. Change the field's value metadata type to TYPE_INTEGER (or TYPE_STRING) instead of TYPE_BINARY, e.g. new ValueMetaInteger(name) or setValueMeta with the right type
  2. Decode the byte[] yourself first (e.g. parse bytes to a string, then use a String/Integer value meta's getInteger) before calling getInteger
  3. If the data is actually binary-encoded strings, set storage type STORAGE_TYPE_BINARY_STRING with a TYPE_INTEGER meta so convertBinaryStringToNativeType handles it, rather than TYPE_BINARY

Example fix

// before
ValueMetaInterface meta = new ValueMetaBase("col", ValueMetaInterface.TYPE_BINARY);
Long n = meta.getInteger(object); // throws
// after
ValueMetaInterface meta = new ValueMetaInteger("col");
// or convert explicitly:
ValueMetaInterface intMeta = new ValueMetaInteger("col");
Long n = intMeta.getInteger(new String(bytes, StandardCharsets.UTF_8).trim());
Defensive patterns

Strategy: validation

Validate before calling

if (meta.getType() == ValueMetaInterface.TYPE_BINARY) {
  throw new IllegalArgumentException("Field " + meta.getName() + " is binary; cannot read as integer");
}
Long n = meta.getInteger(object);

Type guard

boolean isNumericReadable(ValueMetaInterface m) {
  int t = m.getType();
  return t == ValueMetaInterface.TYPE_INTEGER || t == ValueMetaInterface.TYPE_NUMBER
      || t == ValueMetaInterface.TYPE_BIGNUMBER || t == ValueMetaInterface.TYPE_STRING;
}

Try / catch

try {
  Long n = meta.getInteger(object);
} catch (KettleValueException e) {
  log.error("Cannot convert field " + meta.getName() + " to integer", e);
  // skip row or route to error handling stream
}

Prevention

When it happens

Trigger: Calling getInteger(Object) (or the row-level getInteger(row, index) helper) on a ValueMeta whose type was set to ValueMetaInterface.TYPE_BINARY, with any non-null object value. Also happens when a step hands binary data to a field expected to be numeric.

Common situations: Custom plugin steps putting byte[] into a field typed as binary then downstream steps doing arithmetic or numeric mapping; row metadata built with TYPE_BINARY by mistake; transformations that read blobs into normal row streams then apply a 'convert to integer' step.

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/0678530681704dec. Report an issue: GitHub.

Appendix: source

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

              return new Long( ( (BigDecimal) convertBinaryStringToNativeType( (byte[]) object ) ).longValue() );
            case STORAGE_TYPE_INDEXED:
              return new Long( ( (BigDecimal) index[( (Integer) object ).intValue()] ).longValue() );
            default:
              throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
          }
        case TYPE_BOOLEAN:
          switch ( storageType ) {
            case STORAGE_TYPE_NORMAL:
              return convertBooleanToInteger( (Boolean) object );
            case STORAGE_TYPE_BINARY_STRING:
              return convertBooleanToInteger( (Boolean) convertBinaryStringToNativeType( (byte[]) object ) );
            case STORAGE_TYPE_INDEXED:
              return convertBooleanToInteger( (Boolean) index[( (Integer) object ).intValue()] );
            default:
              throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
          }
        case TYPE_BINARY:
          throw new KettleValueException( toString() + " : I don't know how to convert binary values to integers." );
        case TYPE_SERIALIZABLE:
          throw new KettleValueException( toString()
              + " : I don't know how to convert serializable values to integers." );
        default:
          throw new KettleValueException( toString() + " : Unknown type " + type + " specified." );
      }
    } catch ( Exception e ) {
      throw new KettleValueException( "Unexpected conversion error while converting value [" + toString()
          + "] to an Integer", e );
    }
  }

  @Override
  public BigDecimal getBigNumber( Object object ) throws KettleValueException {
    try {
      if ( isNull( object ) ) {
        return null;
      }

View on GitHub (pinned to f3058517a1)