{"record":{"id":"a62e368898749175","repo":"pentaho/pentaho-kettle","slug":"unable-to-find-fieldname-meta-getfieldname-f-in-row-data","errorCode":null,"errorMessage":"Unable to find fieldname [\" + meta.getFieldName()[f] + \"] in row : \" + data.rowMeta","messagePattern":"Unable to find fieldname \\[\" \\+ meta\\.getFieldName\\(\\)\\[f\\] \\+ \"\\] in row : \" \\+ data\\.rowMeta","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/sortedmerge/SortedMerge.java","lineNumber":107,"sourceCode":"          // Which is not yet sorted, we'll get to that later.\n          //\n          data.sortedBuffer.add( new RowSetRow( rowSet, rowSet.getRowMeta(), row ) );\n          if ( data.rowMeta == null ) {\n            data.rowMeta = rowSet.getRowMeta().clone();\n          }\n\n          // What fields do we compare on and in what order?\n\n          // Better cache the location of the partitioning column\n          // First time operation only\n          //\n          if ( data.fieldIndices == null ) {\n            // Get the indexes of the specified sort fields...\n            data.fieldIndices = new int[meta.getFieldName().length];\n            for ( int f = 0; f < data.fieldIndices.length; f++ ) {\n              data.fieldIndices[f] = data.rowMeta.indexOfValue( meta.getFieldName()[f] );\n              if ( data.fieldIndices[f] < 0 ) {\n                throw new KettleStepException( \"Unable to find fieldname [\"\n                  + meta.getFieldName()[f] + \"] in row : \" + data.rowMeta );\n              }\n\n              data.rowMeta.getValueMeta( data.fieldIndices[f] ).setSortedDescending( !meta.getAscending()[f] );\n            }\n          }\n        }\n\n        data.comparator = new Comparator<RowSetRow>() {\n\n          public int compare( RowSetRow o1, RowSetRow o2 ) {\n            try {\n              return o1.getRowMeta().compare( o1.getRowData(), o2.getRowData(), data.fieldIndices );\n            } catch ( KettleValueException e ) {\n              return 0; // TODO see if we should fire off alarms over here... Perhaps throw a RuntimeException.\n            }\n          }\n        };","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/sortedmerge/SortedMerge.java#L89-L125","documentation":"SortedMerge.getRowSorted() lazily computes the indexes of the configured sort fields in the incoming row metadata. If a configured field name is not present in the row (indexOfValue returns -1), it throws a KettleStepException 'Unable to find fieldname [...] in row : ...', including the row metadata description.","triggerScenarios":"A sort field configured in the Sorted Merge step does not exist in the rows arriving from its multiple input hops — upstream rename/removal, case mismatch, or heterogeneous streams where one input lacks the field.","commonSituations":"Merging streams whose fields drifted apart after upstream edits; wrong hop assigned as one of the merge inputs; field name typo or trailing whitespace.","solutions":["Verify every input stream of the Sorted Merge contains all configured sort fields (preview each hop).","Re-select the field names in the Sorted Merge dialog after upstream changes.","Fix case/whitespace mismatches between streams (e.g., 'ID' vs 'id').","Add a Select values / Add constants step upstream to normalize or add the missing field.","Ensure each hop feeding the merge comes from the intended stream."],"exampleFix":"// before\nsortField[0] = \"OrderDate\"; // stream B renamed it to ORDER_DATE\n// after\n// add a Select values rename in stream B: ORDER_DATE -> OrderDate, or update sortField to ORDER_DATE","handlingStrategy":"validation","validationCode":"for (String f : meta.getFieldName()) {\n  if (streamRowMeta.indexOfValue(f) < 0) {\n    throw new IllegalArgumentException(\"SortedMerge field missing: \" + f);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { trans.execute(new String[0]); } catch (KettleStepException e) {\n  if (e.getMessage().startsWith(\"Unable to find fieldname\")) {\n    logError(\"Fix sort field config or upstream stream: \" + e.getMessage());\n  }\n}","preventionTips":["Keep all merged streams schema-identical for sort fields.","Preview each input hop after upstream changes.","Normalize field names/case across streams early in the flow.","Re-select fields in the dialog after any upstream rename."],"tags":["kettle","sorted-merge","missing-field"],"backgroundTag":"record-not-found","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"}