pentaho/pentaho-kettle · error · KettleValueException
: I don't know how to convert an integer to binary.
Error message
: I don't know how to convert an integer to binary.
What it means
ValueMetaBase.getBinary() cannot convert TYPE_INTEGER (long) values into binary bytes; it throws KettleValueException. Binary conversion is only implemented for string-typed values, so integers must be stringified first.
Solutions
- Convert the integer to a string first (vm.getString(value)) then call getBinary on a TYPE_STRING meta.
- Change the field's value meta to TYPE_STRING if byte output is required.
- Use getString() with a conversion mask instead of binary access.
- Catch KettleValueException and format integer fields explicitly.
Example fix
// before
ValueMetaInterface vm = new ValueMeta("i", ValueMetaInterface.TYPE_INTEGER);
byte[] b = vm.getBinary(42L); // throws
// after
String s = vm.getString(42L);
ValueMetaInterface vmStr = new ValueMeta("i", ValueMetaInterface.TYPE_STRING);
byte[] b = vmStr.getBinary(s); Defensive patterns
Strategy: type-guard
Validate before calling
if (meta.getType() == ValueMetaInterface.TYPE_INTEGER) { throw new IllegalArgumentException("Field " + meta.getName() + " is an integer; convert to String before getBinary()"); } Type guard
boolean isBinaryReadable(ValueMetaInterface vm) { return vm.getType() == ValueMetaInterface.TYPE_STRING || vm.getType() == ValueMetaInterface.TYPE_BINARY; } Try / catch
try { byte[] b = vm.getBinary(value); } catch (KettleValueException e) { byte[] b = vm.getString(value).getBytes(StandardCharsets.UTF_8); } Prevention
- Stringify integers before byte-level output.
- Check meta.getType() before calling getBinary().
- Prefer getString() as the universal accessor.
- Normalize types early with Select Values conversions.
When it happens
Trigger: Calling getBinary(object) on a value meta whose type is ValueMetaInterface.TYPE_INTEGER.
Common situations: Binary file output of integer fields; plugin code calling getBinary on all row fields regardless of type; serialization utilities applied to numeric columns.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- : I don't know how to convert a bignumber to binary.
- : I don't know how to convert a binary value to date.
- : I don't know how to convert a boolean to binary.
- : I don't know how to convert a number to binary.
- BaseStep.SafeMode.Exception.MixingTypes
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/72bc279e34fa6616.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java:2405
throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
}
case TYPE_DATE:
throw new KettleValueException( toString() + " : I don't know how to convert a date to binary." );
case TYPE_STRING:
switch ( storageType ) {
case STORAGE_TYPE_NORMAL:
return convertStringToBinaryString( (String) object );
case STORAGE_TYPE_BINARY_STRING:
return (byte[]) object;
case STORAGE_TYPE_INDEXED:
return convertStringToBinaryString( (String) index[( (Integer) object ).intValue()] );
default:
throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
}
case TYPE_NUMBER:
throw new KettleValueException( toString() + " : I don't know how to convert a number to binary." );
case TYPE_INTEGER:
throw new KettleValueException( toString() + " : I don't know how to convert an integer to binary." );
case TYPE_BIGNUMBER:
throw new KettleValueException( toString() + " : I don't know how to convert a bignumber to binary." );
case TYPE_BOOLEAN:
throw new KettleValueException( toString() + " : I don't know how to convert a boolean to binary." );
case TYPE_SERIALIZABLE:
throw new KettleValueException( toString() + " : I don't know how to convert a serializable to binary." );
default:
throw new KettleValueException( toString() + " : Unknown type " + type + " specified." );
}
}
@Override
public byte[] getBinaryString( Object object ) throws KettleValueException {
// If the input is a binary string, we should return the exact same binary
// object IF
// and only IF the formatting options for the storage metadata and this
// object are the same.View on GitHub (pinned to f3058517a1)