{"record":{"id":"c5015958048e2017","repo":"pentaho/pentaho-kettle","slug":"e-getmessage-selectvalues","errorCode":null,"errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","errorType":"exception","errorClass":"KettleConversionException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/selectvalues/SelectValues.java","lineNumber":323,"sourceCode":"    // Change the data too\n    //\n    for ( int i = 0; i < data.metanrs.length; i++ ) {\n      int index = data.metanrs[ i ];\n      ValueMetaInterface fromMeta = rowMeta.getValueMeta( index );\n      ValueMetaInterface toMeta = data.metadataRowMeta.getValueMeta( index );\n\n      // If we need to change from BINARY_STRING storage type to NORMAL...\n      //\n      try {\n        if ( fromMeta.isStorageBinaryString()\n          && meta.getMeta()[ i ].getStorageType() == ValueMetaInterface.STORAGE_TYPE_NORMAL ) {\n          rowData[ index ] = fromMeta.convertBinaryStringToNativeType( (byte[]) rowData[ index ] );\n        }\n        if ( meta.getMeta()[ i ].getType() != ValueMetaInterface.TYPE_NONE && fromMeta.getType() != toMeta.getType() ) {\n          rowData[ index ] = toMeta.convertData( fromMeta, rowData[ index ] );\n        }\n      } catch ( KettleValueException e ) {\n        throw new KettleConversionException( e.getMessage(), Collections.<Exception>singletonList( e ),\n          Collections.singletonList( toMeta ), rowData );\n      }\n    }\n\n    return rowData;\n  }\n\n  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {\n    meta = (SelectValuesMeta) smi;\n    data = (SelectValuesData) sdi;\n\n    Object[] rowData = getRow(); // get row from rowset, wait for our turn, indicate busy!\n    if ( rowData == null ) { // no more input to be expected...\n\n      setOutputDone();\n      return false;\n    }\n","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/selectvalues/SelectValues.java#L305-L341","documentation":"Thrown by SelectValues.metadataValues() when a metadata (type) change on a field fails with a KettleValueException during row conversion. The message is taken from the underlying exception (e.getMessage()) and wrapped in a KettleConversionException that also carries the offending field metadata and the row data. It means the field's value could not be converted from its current type to the target type specified in the step's Metadata tab.","triggerScenarios":"toMeta.convertData(fromMeta, rowData[index]) throws — e.g. converting a non-numeric string to Number, an unparseable string to Date, or an incompatible binary — inside metadataValues() called from processRow when the Metadata tab changes a field's type.","commonSituations":"Select Values Metadata tab changes a String field to Integer/Date while the stream contains 'N/A', empty, or locale-mismatched values; format mask in the metadata doesn't match incoming data; upstream data quality issues.","solutions":["Read the wrapped KettleConversionException message for the failing field and value","Correct the offending row data upstream (cleanse strings, fix formats) before the Select Values step","Adjust the conversion format/mask in the Metadata tab to match the incoming data format","Set a default value or use 'Set to default on error' handling available in the metadata change options","Split the conversion: convert to String first, then to the target type with proper masking"],"exampleFix":"// before: Metadata tab changes 'amount' String -> Number, data contains 'N/A'\n// Metadata change: amount, TYPE_NUMBER\n// after: cleanse upstream first\n// (JavaScript/UDJE step before Select Values)\nvar amount = ( value == \"N/A\" || value == null ) ? \"0\" : value;","handlingStrategy":"validation","validationCode":"// Pre-check that string values are convertible before the Select Values metadata change\nif ( value != null && !value.matches( \"-?\\\\d+(\\\\.\\\\d+)?\" ) ) {\n  value = \"0\"; // or route the row to error handling\n}","typeGuard":"function isNumericString(v) {\n  return typeof v === \"string\" && v.trim() !== \"\" && !isNaN(Number(v));\n}","tryCatchPattern":"try {\n  processRow();\n} catch ( KettleConversionException e ) {\n  logError( \"Conversion failed for field \" + e.getFields().get( 0 ) + \": \" + e.getMessage() );\n  putError( ... ); // route row to error stream with the offending field\n}","preventionTips":["Profile the incoming data (nulls, 'N/A', locale formats) before changing field types","Set explicit conversion masks in the Metadata tab matching the data format","Use the metadata change's default-value/error options for unconvertible values","Cleanse and normalize data in a preceding step before type conversion"],"tags":["data-conversion","type-mismatch","select-values","row-processing"],"backgroundTag":"type-mismatch","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"}