pentaho/pentaho-kettle · error · KettleValueException

Unexpected conversion error while converting value [" +…

Error message

Unexpected conversion error while converting value [" + toString() + "] to a BigNumber

What it means

ValueMetaBase.getBigNumber() wraps any unexpected exception thrown during conversion (ClassCastException, NumberFormatException, NPE inside a convert* method, etc.) into a KettleValueException with the message 'Unexpected conversion error while converting value [<field>] to a BigNumber'. The original exception is attached as the cause. It is a defensive wrapper, so the real bug is in the cause chain or in the value's actual type vs declared type.

Solutions

  1. Inspect the KettleValueException.getCause() to find the real failure (parse error, cast, index)
  2. Verify the value's runtime class matches the metadata type and storage type before conversion (typeMismatch check)
  3. Sanitize input strings (trim, handle empty/null, conversion mask) or set lenient conversion options

Example fix

// before
try { BigDecimal v = meta.getBigNumber(val); }
catch (KettleValueException e) { log.error(e.getMessage()); } // cause swallowed
// after
try { BigDecimal v = meta.getBigNumber(val); }
catch (KettleValueException e) {
  Throwable cause = e.getCause();
  log.error("Field " + meta.getName() + " failed: " + (cause != null ? cause.toString() : e.getMessage()));
}
Defensive patterns

Strategy: try-catch

Validate before calling

Object v0 = value;
if (v0 == null) return null; // nulls are expected, skip conversion
if (meta.isStorageBinaryString()) v0 = meta.convertBinaryStringToNativeType((byte[]) v0);
if (!(v0 instanceof BigDecimal || v0 instanceof Number || v0 instanceof String)) {
  throw new IllegalStateException("Value of " + v0.getClass() + " will not convert to BigDecimal");
}

Type guard

boolean convertibleToBigNumber(Object o) {
  return o == null || o instanceof BigDecimal || o instanceof Number || o instanceof String;
}

Try / catch

try {
  BigDecimal v = meta.getBigNumber(value);
} catch (KettleValueException e) {
  Throwable cause = e.getCause();
  if (cause instanceof NumberFormatException) { /* sanitize/repair the string */ }
  else if (cause instanceof ClassCastException) { /* fix metadata/storage mismatch */ }
  throw new DataException("Field " + meta.getName(), e);
}

Prevention

When it happens

Trigger: Any conversion path inside getBigNumber throwing at runtime: e.g. an indexed-storage Integer out of index bounds, a String that fails BigDecimal parsing, a binary-string storage whose native decode yields a non-numeric object.

Common situations: Dirty source data (non-numeric text in a numeric column) during ETL; storage-type/index arrays inconsistent with the stored value after metadata cloning; legacy metadata where STORAGE_TYPE_INDEXED points at the wrong value array.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

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

          switch ( storageType ) {
            case STORAGE_TYPE_NORMAL:
              return convertBooleanToBigNumber( (Boolean) object );
            case STORAGE_TYPE_BINARY_STRING:
              return convertBooleanToBigNumber( (Boolean) convertBinaryStringToNativeType( (byte[]) object ) );
            case STORAGE_TYPE_INDEXED:
              return convertBooleanToBigNumber( (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 BigDecimals." );
        case TYPE_SERIALIZABLE:
          throw new KettleValueException( toString() + " : I don't know how to convert serializable values to BigDecimals." );
        default:
          throw new KettleValueException( toString() + " : Unknown type " + type + " specified." );
      }
    } catch ( Exception e ) {
      throw new KettleValueException( "Unexpected conversion error while converting value [" + toString()
          + "] to a BigNumber", e );
    }
  }

  @Override
  public Boolean getBoolean( Object object ) throws KettleValueException {
    if ( object == null ) {
      return null;
    }
    switch ( type ) {
      case TYPE_BOOLEAN:
        switch ( storageType ) {
          case STORAGE_TYPE_NORMAL:
            return (Boolean) object;
          case STORAGE_TYPE_BINARY_STRING:
            return (Boolean) convertBinaryStringToNativeType( (byte[]) object );
          case STORAGE_TYPE_INDEXED:
            return (Boolean) index[( (Integer) object ).intValue()];

View on GitHub (pinned to f3058517a1)