pentaho/pentaho-kettle · error · KettleValueException

Caught a number format exception converting minimum length…

Error message

Caught a number format exception converting minimum length with value 

What it means

Thrown from Validator.init() when the configured minimum length for a validation cannot be parsed as an integer. The step converts the string setting (minimumLength) to int during initialization and wraps the NumberFormatException in a KettleValueException including the offending value.

Solutions

  1. Open the Validator step and set minimum length to a plain integer (or leave blank for no limit).
  2. Check for hidden whitespace/special characters; retype the value.
  3. If a variable is used, ensure it resolves to an integer at runtime (e.g. ${MINLEN}=5).
  4. Fix the same pattern for maximum length and min/max value fields, which follow the identical conversion path.
  5. Pre-validate settings programmatically: parse each length with Integer.parseInt and fail fast with a clear message.

Example fix

// before (config value)
field.setMinimumLength("ten");
// after
field.setMinimumLength("10");
// caller-side guard
try { Integer.parseInt(v); } catch (NumberFormatException e) { throw new IllegalArgumentException("min length must be an integer"); }
Defensive patterns

Strategy: validation

Validate before calling

// Before execution: lengths must parse as integers
for (Validation v : meta.getValidations()) {
  for (String s : new String[]{ v.getMinimumLength(), v.getMaximumLength() }) {
    if (!Utils.isEmpty(s)) {
      try { Integer.parseInt(s.trim()); }
      catch (NumberFormatException e) { throw new IllegalStateException("Length not an integer: '" + s + "'"); }
    }
  }
}

Try / catch

try {
  trans.startThreads(); // init() triggers the conversion
} catch (KettleValueException e) {
  if (e.getMessage().contains("number format exception converting minimum length")) {
    String bad = e.getMessage().replaceAll(".*value (.+) to an int.*", "$1");
    logError("Fix min length value: " + bad);
  }
}

Prevention

When it happens

Trigger: init() executing Integer.valueOf(Const.NVL(data.minimumLength[i], "-1")) where minimumLength is a non-numeric, non-empty string like 'ten', '5x', or contains whitespace/spaces.

Common situations: Typing non-numeric text into the min-length field; pasting values with trailing spaces or locale-formatted numbers ('3,'); variables used but not resolved to numbers at runtime; importing settings with bad values.

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/104de7bd50e42938. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/validator/Validator.java:626

          data.startStringNotAllowed[ i ] =
            environmentSubstitute( Const.NVL( field.getStartStringNotAllowed(), "" ) );
          data.endStringNotAllowed[ i ] = environmentSubstitute( Const.NVL( field.getEndStringNotAllowed(), "" ) );
          data.regularExpression[ i ] = environmentSubstitute( Const.NVL( field.getRegularExpression(), "" ) );
          data.regularExpressionNotAllowed[ i ] =
            environmentSubstitute( Const.NVL( field.getRegularExpressionNotAllowed(), "" ) );

          ValueMetaInterface stringMeta = cloneValueMeta( data.constantsMeta[ i ], ValueMetaInterface.TYPE_STRING );
          data.minimumValue[ i ] =
            Utils.isEmpty( data.minimumValueAsString[ i ] ) ? null : data.constantsMeta[ i ].convertData(
              stringMeta, data.minimumValueAsString[ i ] );
          data.maximumValue[ i ] =
            Utils.isEmpty( data.maximumValueAsString[ i ] ) ? null : data.constantsMeta[ i ].convertData(
              stringMeta, data.maximumValueAsString[ i ] );

          try {
            data.fieldsMinimumLengthAsInt[ i ] = Integer.valueOf( Const.NVL( data.minimumLength[ i ], "-1" ) );
          } catch ( NumberFormatException nfe ) {
            throw new KettleValueException(
              "Caught a number format exception converting minimum length with value "
                + data.minimumLength[ i ] + " to an int.", nfe );
          }

          try {
            data.fieldsMaximumLengthAsInt[ i ] = Integer.valueOf( Const.NVL( data.maximumLength[ i ], "-1" ) );
          } catch ( NumberFormatException nfe ) {
            throw new KettleValueException(
              "Caught a number format exception converting minimum length with value "
                + data.maximumLength[ i ] + " to an int.", nfe );
          }

          int listSize = field.getAllowedValues() != null ? field.getAllowedValues().length : 0;
          data.listValues[ i ] = new Object[ listSize ];
          for ( int s = 0; s < listSize; s++ ) {
            data.listValues[ i ][ s ] =
              Utils.isEmpty( field.getAllowedValues()[ s ] ) ? null : data.constantsMeta[ i ].convertData(
                stringMeta, environmentSubstitute( field.getAllowedValues()[ s ] ) );

View on GitHub (pinned to f3058517a1)