{"record":{"id":"6d68732b4e51af64","repo":"pentaho/pentaho-kettle","slug":"filterrows-exception-unexpectederrorfoundinevaluationfuction","errorCode":"FilterRows.Exception.UnexpectedErrorFoundInEvaluationFuction","errorMessage":"FilterRows.Exception.UnexpectedErrorFoundInEvaluationFuction","messagePattern":"FilterRows\\.Exception\\.UnexpectedErrorFoundInEvaluationFuction","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/filterrows/FilterRows.java","lineNumber":59,"sourceCode":"\n  private FilterRowsMeta meta;\n  private FilterRowsData data;\n\n  public FilterRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,\n    Trans trans ) {\n    super( stepMeta, stepDataInterface, copyNr, transMeta, trans );\n  }\n\n  private synchronized boolean keepRow( RowMetaInterface rowMeta, Object[] row ) throws KettleException {\n    try {\n      return meta.getCondition().evaluate( rowMeta, row );\n    } catch ( Exception e ) {\n      String message =\n        BaseMessages.getString( PKG, \"FilterRows.Exception.UnexpectedErrorFoundInEvaluationFuction\" );\n      logError( message );\n      logError( BaseMessages.getString( PKG, \"FilterRows.Log.ErrorOccurredForRow\" ) + rowMeta.getString( row ) );\n      logError( Const.getStackTracker( e ) );\n      throw new KettleException( message, e );\n    }\n  }\n\n  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {\n    meta = (FilterRowsMeta) smi;\n    data = (FilterRowsData) sdi;\n\n    boolean keep;\n\n    Object[] r = getRow(); // Get next usable row from input rowset(s)!\n    if ( r == null ) { // no more input to be expected...\n\n      setOutputDone();\n      return false;\n    }\n\n    if ( first ) {\n      first = false;","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/filterrows/FilterRows.java#L41-L77","documentation":"FilterRows evaluates its Condition against each incoming row to decide the true/false target. keepRow() catches any Exception thrown during that evaluation, logs the row that failed, and rethrows a KettleException with this message - meaning the filter expression itself blew up while processing a specific row.","triggerScenarios":"keepRow() -> condition.evaluate(rowMeta, row) throws: comparing incompatible field types (string vs number), null values against non-null-safe comparisons, or a condition referencing a field whose data changed shape after metadata was cached.","commonSituations":"Filtering on a numeric field that sometimes receives non-numeric/null data; comparing a date field against a wrongly formatted string; upstream step changed field types after the filter was configured.","solutions":["Inspect the log line 'Error occurred while filtering rows' + the row dump to identify the offending field/value.","Check the filter condition's field types vs the actual incoming row metadata (right-click > Show input fields / preview upstream).","Add a 'Value Mapper'/'If field value is null' or 'Data Grid'-style cleanup step upstream to normalize nulls/types before filtering."],"exampleFix":"// before: filter condition compares field 'amount' (Number) to string '10'\n// after: upstream add a Select Values step converting 'amount' from String to Number,\n// or change the condition value type to Number 10","handlingStrategy":"try-catch","validationCode":"// Check condition field types match the incoming metadata before running:\nfor (String field : condition.getUsedFields()) {\n  ValueMetaInterface vm = prevRowMeta.searchValueMeta(field);\n  if (vm == null) throw new IllegalStateException(\"Filter field missing: \" + field);\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(null);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"UnexpectedErrorFoundInEvaluationFuction\")) {\n    log.error(\"Filter condition failed on a row - check field types/nulls in the logged row dump\", e);\n  }\n  throw e;\n}","preventionTips":["Normalize nulls and types upstream (Select Values / Value Mapper) before filtering.","Preview upstream data to spot type drift after upstream changes.","Keep condition comparisons between fields of matching declared types."],"tags":["kettle","condition-evaluation","row-processing"],"backgroundTag":"invalid-argument-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"}