pentaho/pentaho-kettle · error · KettleValueException

: Unable to compare with value []

Error message

 : Unable to compare with value []

What it means

ValueMetaBase.compare(data1, meta2, data2) wraps its whole body in try/catch(Exception); any failure — conversion errors, the unknown-storage-type throws above, NumberFormatException during type conversion — is rethrown as this KettleValueException with both value metas named and the original exception chained as the cause. It is a generic wrapper meaning 'comparison failed while converting/normalizing the two values'.

Solutions

  1. Inspect the chained cause (e.getCause()) to find the real failure and fix the underlying conversion or metadata issue.
  2. Ensure both fields' types/formats are compatible before comparison; use a Select Values step to convert types explicitly.
  3. Correct null or invalid meta2/storage types (see errors 493-495) so the wrapper is not triggered.
  4. Set proper conversion masks (setConversionMask) on string metadata so numeric/date parsing succeeds.

Example fix

// before
int cmp = driverMeta.compare(data1, meta2, data2); // wraps any conversion failure

// after
try {
  int cmp = driverMeta.compare(data1, meta2, data2);
} catch (KettleValueException e) {
  logger.logError("compare failed: " + e.getCause()); // diagnose real cause
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!meta1.getTypeDesc().equals(meta2.getTypeDesc())) {
  data2 = meta1.convertData(meta2, data2); // convert explicitly, surfacing errors early
}

Try / catch

try {
  cmp = meta1.compare(data1, meta2, data2);
} catch (KettleValueException e) {
  Throwable cause = e.getCause();
  logger.logError("compare " + meta1.toStringMeta() + " vs " + meta2.toStringMeta() + " failed: "
      + (cause != null ? cause.toString() : e.getMessage()));
  throw e;
}

Prevention

When it happens

Trigger: Any exception inside compare(data1, meta2, data2): convertData() failing on non-numeric strings, null meta2, unknown storage types, or incompatible data objects passed for conversion between the two value metas.

Common situations: Sort/Merge Join steps hitting rows whose string values cannot be parsed into the driver field's type; comparing fields with mismatched formats (e.g. '1,234.56' vs '1234.56'); downstream of errors 493-495 which get wrapped by this message; locale/format differences from files loaded with wrong masks.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

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

                throw new KettleValueException( meta2.toStringMeta() + " : Unknown storage type : "
                    + meta2.getStorageType() );

            }
          default:
            throw new KettleValueException( toStringMeta() + " : Unknown storage type : " + getStorageType() );
        }
      } else if ( ValueMetaInterface.TYPE_INTEGER == getType() && ValueMetaInterface.TYPE_NUMBER == meta2.getType() ) {
        // BACKLOG-18738
        // compare Double to Integer
        return -meta2.compare( data2, meta2.convertData( this, data1 ) );
      }

      // If the data types are not the same, the first one is the driver...
      // The second data type is converted to the first one.
      //
      return compare( data1, convertData( meta2, data2 ) );
    } catch ( Exception e ) {
      throw new KettleValueException(
          toStringMeta() + " : Unable to compare with value [" + meta2.toStringMeta() + "]", e );
    }
  }

  /**
   * Convert the specified data to the data type specified in this object.
   *
   * @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 convertData( ValueMetaInterface meta2, Object data2 ) throws KettleValueException {
    switch ( getType() ) {

View on GitHub (pinned to f3058517a1)