pentaho/pentaho-kettle · error · KettleValueException

: I can't convert the specified value to data type :

Error message

 : I can't convert the specified value to data type : 

What it means

ValueMetaBase.convertData(meta2, data2) converts data2 to this value's type by calling the corresponding getter on meta2 (getString/getNumber/.../getBinary). If this meta's type code is not one of the seven supported types (including TYPE_NONE), the default branch throws this KettleValueException. It means conversion was requested toward an undefined or unsupported target data type.

Solutions

  1. Set a valid type on the target metadata before conversion: setType(ValueMetaInterface.TYPE_STRING) or another supported type.
  2. Guard with getType() checks and skip/convert unsupported fields upstream (Select Values / Metadata step).
  3. Replace TYPE_NONE metadata with concrete metadata derived from source rows (clone a properly typed ValueMeta).
  4. If a plugin introduces exotic types, map them to core types before using convertData.

Example fix

// before
ValueMetaInterface target = new ValueMeta("out"); // TYPE_NONE
Object v = target.convertData(sourceMeta, data); // throws

// after
ValueMetaInterface target = new ValueMeta("out", ValueMetaInterface.TYPE_STRING);
Object v = target.convertData(sourceMeta, data);
Defensive patterns

Strategy: validation

Validate before calling

if (target.getType() == ValueMetaInterface.TYPE_NONE) {
  throw new IllegalStateException("Target " + target.toStringMeta() + " has no type for convertData");
}

Type guard

boolean isConvertibleTarget(ValueMetaInterface m) {
  int t = m.getType();
  return t == ValueMetaInterface.TYPE_STRING || t == ValueMetaInterface.TYPE_NUMBER
      || t == ValueMetaInterface.TYPE_INTEGER || t == ValueMetaInterface.TYPE_DATE
      || t == ValueMetaInterface.TYPE_BIGNUMBER || t == ValueMetaInterface.TYPE_BOOLEAN
      || t == ValueMetaInterface.TYPE_BINARY;
}

Try / catch

try { Object v = target.convertData(sourceMeta, data); } catch (KettleValueException e) {
  if (e.getMessage().contains("I can't convert")) {
    target.setType(ValueMetaInterface.TYPE_STRING);
    Object v = target.convertData(sourceMeta, data);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling convertData(ValueMetaInterface, Object) when this meta's getType() is TYPE_NONE or any type code outside STRING/NUMBER/INTEGER/DATE/BIGNUMBER/BOOLEAN/BINARY.

Common situations: ValueMeta constructed without a type (new ValueMeta("x")); cross-type row conversion in steps like Stream Lookup or Update where target metadata was never initialized; plugin fields with custom type codes unknown to core conversion.

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/175e9834a9164efe. Report an issue: GitHub.

Appendix: source

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

  public Object convertData( ValueMetaInterface meta2, Object data2 ) throws KettleValueException {
    switch ( getType() ) {
      case TYPE_NONE:
      case TYPE_STRING:
        return meta2.getString( data2 );
      case TYPE_NUMBER:
        return meta2.getNumber( data2 );
      case TYPE_INTEGER:
        return meta2.getInteger( data2 );
      case TYPE_DATE:
        return meta2.getDate( data2 );
      case TYPE_BIGNUMBER:
        return meta2.getBigNumber( data2 );
      case TYPE_BOOLEAN:
        return meta2.getBoolean( data2 );
      case TYPE_BINARY:
        return meta2.getBinary( data2 );
      default:
        throw new KettleValueException( toString() + " : I can't convert the specified value to data type : "
            + getType() );
    }
  }

  /**
   * Convert the specified data to the data type specified in this object. For String conversion, be compatible with
   * version 2.5.2.
   *
   * @param meta2
   *          the metadata of the object to be converted
   * @param data2
   *          the data of the object to be converted
   * @return the object in the data type of this value metadata object
   * @throws KettleValueException
   *           in case there is a data conversion error
   */
  @Override
  public Object convertDataCompatible( ValueMetaInterface meta2, Object data2 ) throws KettleValueException {

View on GitHub (pinned to f3058517a1)