pentaho/pentaho-kettle · error · KettleException
Field nr in file ' ' is called ' ' while it was called ' '…
Error message
Field nr {i} in file '{filename}' is called '{fieldName}' while it was called '{firstFileName}' in the first file What it means
The SAS Input step validates that every file processed after the first has exactly the same field layout as the first file, since a single row layout is shared for all input files. When field at index i has a different (case-insensitive) name than the same-position field in the first file, processRow throws this KettleException.
Solutions
- Open the offending file (named in the message) in a SAS viewer and rename the field to match the first file.
- Restructure the transformation to use separate SasInput steps per file schema, then merge rows downstream.
- Pre-export the files so all share an identical column layout, then re-run the transformation.
Example fix
// before: files with inconsistent columns read by one step // after: rename the column in the mismatched SAS file to match the first file, // or split into two SasInput steps and union the streams
Defensive patterns
Strategy: validation
Validate before calling
// Compare column layouts before feeding multiple files to one step
List<String> first = layoutOf(files.get(0));
for (File f : files.subList(1, files.size())) {
List<String> cols = layoutOf(f);
if (cols.size() != first.size()) throw new IllegalStateException("Column count differs in " + f);
for (int i = 0; i < cols.size(); i++) {
if (!cols.get(i).equalsIgnoreCase(first.get(i)))
throw new IllegalStateException("Field " + i + " mismatch in " + f + ": " + cols.get(i) + " vs " + first.get(i));
}
} Prevention
- Export all SAS files from the same schema/version and diff column lists before running the transformation.
- Keep one SasInput step per file schema; union streams downstream instead of sharing a step.
- Automate a pre-check that compares SAS file layouts before scheduling the transformation.
When it happens
Trigger: Running the SasInput step with multiple SAS7BAT files where a later file's column at position i is named differently from the first file's column at position i (comparison is case-insensitive, so only true name differences trigger).
Common situations: Pointing the step at a directory of SAS export files where some exports came from a newer/older schema; files generated by different tools with renamed columns; a typo in one file's column headers.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Field nr in file ' ' is of data type ' ' while it was ' '…
- FuzzyMatchMeta.Exception.ReturnValueCanNotBeFound
- Selected field ' ' couldn't be found in file
- There was an error reading from SAS7BAT file
- Unable to create new value meta type
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/76bda46782b24e52.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInput.java:118
logBasic( BaseMessages.getString( PKG, "SASInput.Log.OpenedSASFile" ) + " : [" + data.helper + "]" );
// verify the row layout...
//
if ( data.fileLayout == null ) {
data.fileLayout = data.helper.getRowMeta();
} else {
// Verify that all files are of the same file format, this is a requirement...
//
if ( data.fileLayout.size() != data.helper.getRowMeta().size() ) {
throw new KettleException( "All input files need to have the same number of fields. File '"
+ filename + "' has " + data.helper.getRowMeta().size() + " fields while the first file only had "
+ data.fileLayout.size() );
}
for ( int i = 0; i < data.fileLayout.size(); i++ ) {
ValueMetaInterface first = data.fileLayout.getValueMeta( i );
ValueMetaInterface second = data.helper.getRowMeta().getValueMeta( i );
if ( !first.getName().equalsIgnoreCase( second.getName() ) ) {
throw new KettleException( "Field nr "
+ i + " in file '" + filename + "' is called '" + second.getName() + "' while it was called '"
+ first.getName() + "' in the first file" );
}
if ( first.getType() != second.getType() ) {
throw new KettleException( "Field nr "
+ i + " in file '" + filename + "' is of data type '" + second.getTypeDesc() + "' while it was '"
+ first.getTypeDesc() + "' in the first file" );
}
}
}
// Also make sure that we only read the specified fields, not any other...
//
if ( first ) {
first = false;
data.fieldIndexes = new ArrayList<Integer>();
for ( SasInputField field : meta.getOutputFields() ) {View on GitHub (pinned to f3058517a1)