pentaho/pentaho-kettle · error · KettleException
RandomCreditCardNumbberGenerator.UnknownCardtype
RandomCreditCardNumbberGenerator.UnknownCardtype
Error message
RandomCreditCardNumbberGenerator.UnknownCardtype
What it means
GenerateCreditCardNumbers switches on the cardType int; the default branch throws this localized error when the type is not one of the defined CARD_TYPE_* constants. The generator cannot recognize the requested card type.
Solutions
- Select a valid card type in the Random CC Number Generator step dialog
- Inspect the stored ccType attribute/XML value and set it to a supported constant
- Recreate the step if its saved attributes come from an incompatible version
- Validate the card type input upstream before invoking the generator
Example fix
// before int cardType = 99; // unknown generator.generate(cardType, 16, 10); // after int cardType = RandomCreditCardNumberGenerator.CARD_TYPE_VISA; generator.generate(cardType, 16, 10);
Defensive patterns
Strategy: validation
Validate before calling
// Java
if ( cardType < 0 || cardType > RandomCreditCardNumberGenerator.CARD_TYPE_LASER ) {
throw new IllegalArgumentException( "Unknown card type: " + cardType );
} Try / catch
try {
String[] cards = RandomCreditCardNumberGenerator.GenerateCreditCardNumbers( cardType, size, n );
} catch ( KettleException e ) {
if ( e.getMessage().contains( "UnknownCardtype" ) ) {
cardType = RandomCreditCardNumberGenerator.CARD_TYPE_VISA; // or fail fast
} else { throw e; }
} Prevention
- Use named CARD_TYPE_* constants, never magic ints
- Re-save steps after plugin upgrades to refresh stored enums
- Validate ccType attributes when importing transformations
When it happens
Trigger: Calling GenerateCreditCardNumbers with a cardType value outside the plugin's constants (e.g. hand-set XML/repository value of 99 or -1), or a stored attribute from an incompatible plugin version.
Common situations: Repository/XML holds a stale or corrupted ccType value; a user manually edited the transformation file; upgrading/downgrading the plugin changed the type numbering.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- RandomCreditCardNumbberGenerator.UnSupportedLength
- Unknown value ' ' for enum
- A connection of type PALO is expected
- A connection of type PALO is expected
- A server socket allocation always has to accompanied by a…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/b2e94f68ecbb8396.
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:291
break;
case CARD_TYPE_MAESTRO:
checkLength( cardType, size, MAESTRO_LENGTH_LIST );
cards = credit_card_number( MAESTRO_PREFIX_LIST, size, howMany );
break;
case CARD_TYPE_SOLO:
checkLength( cardType, size, SOLO_LENGTH_LIST );
cards = credit_card_number( SOLO_PREFIX_LIST, size, howMany );
break;
case CARD_TYPE_SWITCH:
checkLength( cardType, size, SWITCH_LENGTH_LIST );
cards = credit_card_number( SWITCH_PREFIX_LIST, size, howMany );
break;
case CARD_TYPE_LASER:
checkLength( cardType, size, LASER_LENGTH_LIST );
cards = credit_card_number( LASER_PREFIX_LIST, size, howMany );
break;
default:
throw new KettleException( BaseMessages.getString(
PKG, "RandomCreditCardNumbberGenerator.UnknownCardtype", String.valueOf( cardType ) ) );
}
return cards;
}
}
View on GitHub (pinned to f3058517a1)