{"record":{"id":"87f267fac6ab0b48","repo":"pentaho/pentaho-kettle","slug":"creditcardvalidator-error-cardfieldmissing","errorCode":"CreditCardValidator.Error.CardFieldMissing","errorMessage":"CreditCardValidator.Error.CardFieldMissing","messagePattern":"CreditCardValidator\\.Error\\.CardFieldMissing","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidator.java","lineNumber":80,"sourceCode":"\n    boolean isValid = false;\n    String cardType = null;\n    String unValid = null;\n\n    if ( first ) {\n      first = false;\n\n      // get the RowMeta\n      data.previousRowMeta = getInputRowMeta().clone();\n      data.NrPrevFields = data.previousRowMeta.size();\n      data.outputRowMeta = data.previousRowMeta;\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n        metaStore );\n\n      // Check if field is provided\n      if ( Utils.isEmpty( meta.getDynamicField() ) ) {\n        logError( BaseMessages.getString( PKG, \"CreditCardValidator.Error.CardFieldMissing\" ) );\n        throw new KettleException( BaseMessages.getString( PKG, \"CreditCardValidator.Error.CardFieldMissing\" ) );\n      }\n\n      // cache the position of the field\n      if ( data.indexOfField < 0 ) {\n        data.indexOfField = getInputRowMeta().indexOfValue( meta.getDynamicField() );\n        if ( data.indexOfField < 0 ) {\n          // The field is unreachable !\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"CreditCardValidator.Exception.CouldnotFindField\", meta.getDynamicField() ) );\n        }\n      }\n      data.realResultFieldname = environmentSubstitute( meta.getResultFieldName() );\n      if ( Utils.isEmpty( data.realResultFieldname ) ) {\n        throw new KettleException( BaseMessages\n          .getString( PKG, \"CreditCardValidator.Exception.ResultFieldMissing\" ) );\n      }\n      data.realCardTypeFieldname = environmentSubstitute( meta.getCardType() );\n      data.realNotValidMsgFieldname = environmentSubstitute( meta.getNotValidMsg() );","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidator.java#L62-L98","documentation":"The Credit Card Validator step validates credit card numbers found in a stream field. During processRow initialization it requires the step metadata to name the input field containing the card number (dynamicField). If that field is empty, it logs the CardFieldMissing message and throws a KettleException, aborting the step.","triggerScenarios":"Running a transformation where the CreditCardValidator step was configured without setting the 'field name to validate' in the step dialog.","commonSituations":"Kettle metadata XML/repertoire entry missing the dynamicField attribute; cloning a step and forgetting to configure it; environment substitution yielding an empty value.","solutions":["Open the step dialog and set the 'field name to validate' to an existing input field","Verify the saved transformation XML contains <field_to_validate> with a value","Set the field programmatically via meta.setDynamicField(\"card_number\") before execution"],"exampleFix":"// before\nmeta.setDynamicField(null);\n// after\nmeta.setDynamicField(\"card_number\"); // must exist in the input stream","handlingStrategy":"validation","validationCode":"if (meta.getDynamicField() == null || meta.getDynamicField().isEmpty()) throw new IllegalArgumentException(\"Set the field to validate before running\");","typeGuard":null,"tryCatchPattern":"try { step.processRow(); } catch (KettleException e) { logError(\"Validator misconfigured: \" + e.getMessage()); }","preventionTips":["Always fill 'field name to validate' in the step dialog","Validate step metadata programmatically before executing transformations in CI"],"tags":["kettle","pdi","step-configuration"],"backgroundTag":"missing-required-config-field","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"}