pentaho/pentaho-kettle · error · KettleValueException
: I don't know how to convert a boolean to binary.
Error message
: I don't know how to convert a boolean to binary.
What it means
ValueMetaBase.getBinary() does not support TYPE_BOOLEAN values; boolean has no defined binary-string encoding, so KettleValueException is thrown. Convert the boolean to a string (e.g. "true"/"false" or "Y"/"N") before requesting bytes.
Solutions
- Convert the boolean to a string first (vm.getString(value)) and call getBinary on a TYPE_STRING meta.
- Change the field metadata to TYPE_STRING for binary output.
- Encode the boolean as an integer (0/1) in an INTEGER field if a byte-level representation is needed.
- Catch KettleValueException and handle boolean fields with explicit encoding.
Example fix
// before
ValueMetaInterface vm = new ValueMeta("flag", ValueMetaInterface.TYPE_BOOLEAN);
byte[] b = vm.getBinary(Boolean.TRUE); // throws
// after
String s = vm.getString(Boolean.TRUE);
ValueMetaInterface vmStr = new ValueMeta("flag", ValueMetaInterface.TYPE_STRING);
byte[] b = vmStr.getBinary(s); Defensive patterns
Strategy: type-guard
Validate before calling
if (meta.getType() == ValueMetaInterface.TYPE_BOOLEAN) { throw new IllegalArgumentException("Field " + meta.getName() + " is a boolean; 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
- Encode booleans as strings or 0/1 integers before binary output.
- Check meta.getType() before calling getBinary().
- Define a consistent boolean encoding convention across steps.
- Test outputs with boolean fields present in the row.
When it happens
Trigger: Calling getBinary(object) on a value meta whose type is ValueMetaInterface.TYPE_BOOLEAN.
Common situations: Binary file output including boolean flag fields; generic row serialization code; plugins calling getBinary on every field regardless of type.
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 number to binary.
- : I don't know how to convert an integer to binary.
- BaseStep.SafeMode.Exception.MixingTypes
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/959d25d8882f7d28.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java:2409
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.
//
if ( isStorageBinaryString() && identicalFormat ) {
return (byte[]) object; // shortcut it directly for better performance.
}View on GitHub (pinned to f3058517a1)