{"record":{"id":"75b1e405a51e3dde","repo":"pentaho/pentaho-kettle","slug":"creditcardvalidator-exception-resultfieldmissing","errorCode":"CreditCardValidator.Exception.ResultFieldMissing","errorMessage":"CreditCardValidator.Exception.ResultFieldMissing","messagePattern":"CreditCardValidator\\.Exception\\.ResultFieldMissing","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":94,"sourceCode":"\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() );\n\n    } // End If first\n\n    Object[] outputRow = RowDataUtil.allocateRowData( data.outputRowMeta.size() );\n    for ( int i = 0; i < data.NrPrevFields; i++ ) {\n      outputRow[i] = r[i];\n    }\n    try {\n      // get field\n      String fieldvalue = getInputRowMeta().getString( r, data.indexOfField );\n      if ( meta.isOnlyDigits() ) {\n        fieldvalue = Const.getDigitsOnly( fieldvalue );\n      }\n","sourceCodeStart":76,"sourceCodeEnd":112,"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#L76-L112","documentation":"The step requires a result field name where it will output the validation result. During first-row initialization it applies environment substitution to resultFieldName and throws KettleException with ResultFieldMissing if the substituted value is empty.","triggerScenarios":"processRow finds meta.getResultFieldName() empty, or the configured value is an environment variable like ${RESULT_FIELD} that resolves to empty/undefined.","commonSituations":"Step dialog saved without a result field name; KETTLE variable not defined at runtime so ${...} substitutes to empty; importing metadata from another environment missing variable definitions.","solutions":["Set the 'result field name' in the step dialog (e.g. 'isValid')","Define the referenced environment variable in kettle.properties or the transformation settings","Verify with ${Internal....} variables that substitution resolves non-empty"],"exampleFix":"// before\nmeta.setResultFieldName(\"${UNDEFINED_VAR}\");\n// after\nmeta.setResultFieldName(\"cardIsValid\");","handlingStrategy":"validation","validationCode":"if (meta.getResultFieldName() == null || environmentSubstitute(meta.getResultFieldName()).isEmpty()) throw new IllegalArgumentException(\"Result field name must be set\");","typeGuard":null,"tryCatchPattern":"try { trans.execute(...); } catch (KettleException e) { if (e.getMessage().contains(\"ResultFieldMissing\")) { logError(\"Define the result field\"); } }","preventionTips":["Define all ${VARIABLES} used in field names in kettle.properties","Never leave the result field blank when copying step metadata"],"tags":["kettle","pdi","step-configuration"],"backgroundTag":"empty-required-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"}