{"record":{"id":"b2e94f68ecbb8396","repo":"pentaho/pentaho-kettle","slug":"randomcreditcardnumbbergenerator-unknowncardtype","errorCode":"RandomCreditCardNumbberGenerator.UnknownCardtype","errorMessage":"RandomCreditCardNumbberGenerator.UnknownCardtype","messagePattern":"RandomCreditCardNumbberGenerator\\.UnknownCardtype","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCreditCardNumberGenerator.java","lineNumber":291,"sourceCode":"        break;\n      case CARD_TYPE_MAESTRO:\n        checkLength( cardType, size, MAESTRO_LENGTH_LIST );\n        cards = credit_card_number( MAESTRO_PREFIX_LIST, size, howMany );\n        break;\n      case CARD_TYPE_SOLO:\n        checkLength( cardType, size, SOLO_LENGTH_LIST );\n        cards = credit_card_number( SOLO_PREFIX_LIST, size, howMany );\n        break;\n      case CARD_TYPE_SWITCH:\n        checkLength( cardType, size, SWITCH_LENGTH_LIST );\n        cards = credit_card_number( SWITCH_PREFIX_LIST, size, howMany );\n        break;\n      case CARD_TYPE_LASER:\n        checkLength( cardType, size, LASER_LENGTH_LIST );\n        cards = credit_card_number( LASER_PREFIX_LIST, size, howMany );\n        break;\n      default:\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"RandomCreditCardNumbberGenerator.UnknownCardtype\", String.valueOf( cardType ) ) );\n    }\n    return cards;\n  }\n\n}\n","sourceCodeStart":273,"sourceCodeEnd":298,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCreditCardNumberGenerator.java#L273-L298","documentation":"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.","triggerScenarios":"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.","commonSituations":"Repository/XML holds a stale or corrupted ccType value; a user manually edited the transformation file; upgrading/downgrading the plugin changed the type numbering.","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"],"exampleFix":"// before\nint cardType = 99; // unknown\ngenerator.generate(cardType, 16, 10);\n// after\nint cardType = RandomCreditCardNumberGenerator.CARD_TYPE_VISA;\ngenerator.generate(cardType, 16, 10);","handlingStrategy":"validation","validationCode":"// Java\nif ( cardType < 0 || cardType > RandomCreditCardNumberGenerator.CARD_TYPE_LASER ) {\n  throw new IllegalArgumentException( \"Unknown card type: \" + cardType );\n}","typeGuard":null,"tryCatchPattern":"try {\n  String[] cards = RandomCreditCardNumberGenerator.GenerateCreditCardNumbers( cardType, size, n );\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"UnknownCardtype\" ) ) {\n    cardType = RandomCreditCardNumberGenerator.CARD_TYPE_VISA; // or fail fast\n  } else { throw e; }\n}","preventionTips":["Use named CARD_TYPE_* constants, never magic ints","Re-save steps after plugin upgrades to refresh stored enums","Validate ccType attributes when importing transformations"],"tags":["validation","enum","credit-card"],"backgroundTag":"invalid-enum-value","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}