pentaho/pentaho-kettle · error · KettleException
SortRowsMeta.CheckResult.StepFieldNotInInputStream
SortRowsMeta.CheckResult.StepFieldNotInInputStream
Error message
SortRowsMeta.CheckResult.StepFieldNotInInputStream
What it means
During SortRows.processRow() initialization, each configured sort field is looked up by name in the incoming row metadata. If indexOfValue() returns -1 the step cannot sort, so it throws a KettleException using the SortRowsMeta.CheckResult.StepFieldNotInInputStream message, naming the missing field and step.
Solutions
- Open the Sort rows step and re-select field names from the current upstream field list (delete and re-add stale entries).
- Check exact case and whitespace of the field name vs upstream output.
- Use 'Get Fields' in the step dialog after the upstream step is finalized.
- Preview the input row (right-click step > Preview) to confirm which fields actually arrive.
- Fix upstream steps that conditionally drop or rename the field.
Example fix
// before sortField[0] = "CUSTOMER ID"; // upstream field is 'CUSTOMER_ID' // after sortField[0] = "CUSTOMER_ID";
Defensive patterns
Strategy: validation
Validate before calling
for (String f : meta.getFieldName()) {
if (inputRowMeta.indexOfValue(f) < 0) {
throw new IllegalArgumentException("Sort field not in stream: " + f);
}
} Try / catch
try { trans.execute(new String[0]); } catch (KettleException e) {
if (e.getMessage().contains("field") && e.getMessage().contains("row")) {
logError("Sort field missing from input: " + e.getMessage());
}
} Prevention
- Use 'Get Fields' in the Sort dialog after upstream steps are final.
- Re-validate transformations after renaming upstream fields.
- Preview input rows before production runs.
- Avoid conditional upstream steps that drop sort keys.
When it happens
Trigger: A field name configured in the Sort rows step does not exist in the row arriving at runtime — typically because an upstream step was changed/removed, field names are case-mismatched, or the hop delivering the row differs from the design-time preview.
Common situations: Renaming a column upstream (e.g., in Select values) without updating Sort rows; streams where fields appear only conditionally; whitespace differences in the field name; switching the primary input hop.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Can not find field [ ] in the input stream!
- MergeRowsMeta.Exception.FlagFieldNotSpecified
- AnalyticQueryMeta.Exception.SubjectFieldNotFound
- BaseStep.SafeMode.Exception.DoubleFieldnames
- BaseStep.SafeMode.Exception.MixingLayout
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/8707d3a7256e432f.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/sort/SortRows.java:420
return false;
}
}
}
String[] fieldNames = meta.getFieldName();
data.fieldnrs = new int[fieldNames.length];
List<Integer> toConvert = new ArrayList<Integer>();
// Metadata
data.outputRowMeta = inputRowMeta.clone();
meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
metaStore );
data.comparator = new RowTemapFileComparator( data.outputRowMeta, data.fieldnrs );
for ( int i = 0; i < fieldNames.length; i++ ) {
data.fieldnrs[i] = inputRowMeta.indexOfValue( fieldNames[i] );
if ( data.fieldnrs[i] < 0 ) {
throw new KettleException( BaseMessages.getString( PKG, "SortRowsMeta.CheckResult.StepFieldNotInInputStream",
meta.getFieldName()[i], getStepname() ) );
}
// do we need binary conversion for this type?
if ( inputRowMeta.getValueMeta( data.fieldnrs[i] ).isStorageBinaryString() ) {
toConvert.add( data.fieldnrs[i] );
}
}
data.convertKeysToNative = toConvert.isEmpty() ? null : new int[toConvert.size()];
int i = 0;
for ( Integer in : toConvert ) {
data.convertKeysToNative[i] = in;
i++;
}
data.rowComparator = new RowObjectArrayComparator( data.outputRowMeta, data.fieldnrs );
} // end if first
// it is not first row and it is null
if ( r == null ) {View on GitHub (pinned to f3058517a1)