pentaho/pentaho-kettle · error · KettleException
AddXML.Exception.FieldNotFound (localized message with…
Error message
AddXML.Exception.FieldNotFound (localized message with field name)
What it means
The AddXML step looks up each configured output field's index in the incoming row metadata; if a field name is not present in the input stream (indexOfValue < 0) it throws KettleException with the localized message AddXML.Exception.FieldNotFound parameterized with the field name. The step cannot build XML from fields that never arrive.
Solutions
- Update the AddXML field list to match the actual incoming field names
- Restore the field in the upstream step
- Re-run 'Get Fields' in the step dialog to refresh the mapping
- Remove stale entries for fields no longer produced
Example fix
// before: field renamed upstream but AddXML still references old name new XMLField( "amount_old", ... ); // after: reference the renamed field new XMLField( "amount", ... );
Defensive patterns
Strategy: validation
Validate before calling
for ( XMLField f : meta.getOutputFields() ) {
if ( inputRowMeta.indexOfValue( f.getFieldName() ) < 0 ) {
throw new IllegalStateException( "Field not in input stream: " + f.getFieldName() );
}
} Try / catch
try {
step.processRow( meta, data );
} catch ( KettleException e ) {
logError( "AddXML configuration error: " + e.getMessage(), e );
stopAll();
setErrors( 1 );
} Prevention
- Refresh the field list ('Get Fields') after any upstream change
- Avoid renaming fields without downstream impact analysis
- Check variable-driven field names resolve at runtime
- Use a specification/impact report before refactoring stream layouts
When it happens
Trigger: processRow() first-row initialization: meta.getOutputFields()[i].getFieldName() is not found in getInputRowMeta().
Common situations: Upstream step renamed or removed the field; field arrives only on some rows' metadata; copy/paste of step config between transformations with different layouts; variable-driven field name that doesn't resolve.
Related errors
- Couldn't find field ' ' in row!
- Field [ ] is required and couldn't be found!
- A deadlock was detected between steps
- AbortMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepo…
- AggregateRowsMeta.Exception.UnableToLoadStepInfo
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/0623d67b2400f8ea.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXML.java:94
setOutputDone();
return false;
}
if ( first ) {
first = false;
data.outputRowMeta = getInputRowMeta().clone();
meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
metaStore );
// Cache the field name indexes
//
data.fieldIndexes = new int[meta.getOutputFields().length];
for ( int i = 0; i < data.fieldIndexes.length; i++ ) {
String fieldsName = meta.getOutputFields()[i].getFieldName();
data.fieldIndexes[i] = getInputRowMeta().indexOfValue( fieldsName );
if ( data.fieldIndexes[i] < 0 ) {
throw new KettleException( BaseMessages.getString( PKG, "AddXML.Exception.FieldNotFound", fieldsName ) );
}
}
}
Document xmldoc = getDomImplentation().createDocument( null, meta.getRootNode(), null );
Element root = xmldoc.getDocumentElement();
for ( int i = 0; i < meta.getOutputFields().length; i++ ) {
XMLField outputField = meta.getOutputFields()[i];
String fieldname = outputField.getFieldName();
ValueMetaInterface v = getInputRowMeta().getValueMeta( data.fieldIndexes[i] );
Object valueData = r[data.fieldIndexes[i]];
if ( !meta.isOmitNullValues() || !v.isNull( valueData ) ) {
String value = formatField( v, valueData, outputField );
String element = outputField.getElementName();
if ( element == null || element.length() == 0 ) {View on GitHub (pinned to f3058517a1)