pentaho/pentaho-kettle · error · KettleException
RandomCreditCardNumbberGenerator.UnSupportedLength
RandomCreditCardNumbberGenerator.UnSupportedLength
Error message
RandomCreditCardNumbberGenerator.UnSupportedLength
What it means
checkLength verifies that the requested card number size is in the supported length list for the given card type; if not, it throws a KettleException with this localized message naming the size and card name. Credit card numbers must match fixed lengths (e.g. Visa 16, Amex 15) to be valid.
Solutions
- Set the card size to a supported length for the selected card type (Visa 13/16, Amex 15, MasterCard 16, etc.)
- Align the card type and size settings — pick the type first, then one of its allowed lengths
- If size comes from a field/variable, log its resolved value and correct it
- Add validation in the step dialog to restrict the size field to the selected type's lengths
Example fix
// before generator.generate(CARD_TYPE_VISA, 10, 100); // 10 unsupported // after generator.generate(CARD_TYPE_VISA, 16, 100);
Defensive patterns
Strategy: validation
Validate before calling
// Java — validate size before generating
boolean supported = false;
for ( int len : RandomCreditCardNumberGenerator.VISA_LENGTH_LIST ) {
if ( len == size ) { supported = true; break; }
}
if ( !supported ) throw new IllegalArgumentException( "Size " + size + " unsupported for card type" ); Try / catch
try {
String[] cards = RandomCreditCardNumberGenerator.GenerateCreditCardNumbers( type, size, n );
} catch ( KettleException e ) {
logError( "Unsupported length/card type combo: " + e.getMessage() );
} Prevention
- Map card types to their legal lengths in UI or caller code
- Log resolved variable/field values feeding the size
- Use dropdowns limited to valid lengths instead of free-text
When it happens
Trigger: GenerateCreditCardNumbers(cardType, size, howMany) is called with a size that is not in the card type's LENGTH_LIST, e.g. size=10 for Visa or a negative/zero size from a misconfigured field.
Common situations: User types an arbitrary card length in the step dialog; card length read from a field/variable evaluates to an unexpected value; changing card type without updating the length.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- RandomCreditCardNumbberGenerator.UnknownCardtype
- A connection of type PALO is expected
- A connection of type PALO is expected
- A server socket allocation always has to accompanied by a…
- A server socket allocation always has to accompanied by…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/48b7b3e7667c8b0f.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCreditCardNumberGenerator.java:221
int randomArrayIndex = (int) Math.floor( Math.random() * prefixList.length );
String ccnumber = prefixList[randomArrayIndex];
result.push( completed_number( ccnumber, length ) );
}
return result.toArray( new String[result.size()] );
}
private static void checkLength( int cardType, int size, int[] lengths ) throws KettleException {
if ( lengths.length == 0 ) {
return;
}
for ( int i = 0; i < lengths.length; i++ ) {
if ( size == lengths[i] ) {
// The size is supported for the card type
return;
}
}
throw new KettleException( BaseMessages
.getString(
PKG, "RandomCreditCardNumbberGenerator.UnSupportedLength", String.valueOf( size ),
getCardName( cardType ) ) );
}
public static String[] GenerateCreditCardNumbers( int cardType, int size, int howMany ) throws KettleException {
String[] cards = null;
switch ( cardType ) {
case CARD_TYPE_MASTERCARD:
checkLength( cardType, size, MASTERCARD_LENGTH_LIST );
cards = credit_card_number( MASTERCARD_PREFIX_LIST, size, howMany );
break;
case CARD_TYPE_AMEX:
checkLength( cardType, size, AMEX_LENGTH_LIST );
cards = credit_card_number( AMEX_PREFIX_LIST, size, howMany );
break;
case CARD_TYPE_DINERS:
checkLength( cardType, size, DINERS_LENGTH_LIST );View on GitHub (pinned to f3058517a1)