pentaho/pentaho-kettle · error · KettleXMLException
It was not possibke to load the Trim metadata from XML
Error message
It was not possibke to load the Trim metadata from XML
What it means
TableCompareMeta.readData() wraps any Exception raised while parsing the step's XML node into a KettleXMLException with the (typo'd) message 'It was not possibke to load the Trim metadata from XML'. It indicates the <step> node for a TableCompare step is malformed or missing expected tags.
Solutions
- Inspect the cause (getCause()) to find the exact XML parsing failure and fix the offending tag in the .ktr.
- Re-open the transformation in Spoon and re-create/re-configure the TableCompare step to regenerate valid XML.
- Restore the .ktr from version control/backup if it was truncated or corrupted.
- Check the step attributes (key_description_field, value_reference_field, value_compare_field etc.) are correctly nested under the step node.
Example fix
// before (broken .ktr fragment) <step><name>Table compare</name> <key_description_field>desc // after (well-formed) <step><name>Table compare</name> <key_description_field>desc</key_description_field> <value_reference_field>ref_val</value_reference_field> <value_compare_field>cmp_val</value_compare_field> </step>
Defensive patterns
Strategy: try-catch
Validate before calling
// validate the XML is well-formed and contains expected tags before loadXML
Document doc = XMLHandler.loadXMLFile( ktrFile );
if ( XMLHandler.getTagValue( doc, "step", "key_description_field" ) == null ) {
throw new IllegalStateException( "TableCompare step XML missing key_description_field" );
} Try / catch
try {
transMeta.loadXML( file, ... );
} catch ( KettleXMLException e ) {
if ( e.getMessage().contains( "Trim metadata" ) ) {
logError( "Corrupt TableCompare step XML: " + e.getCause() );
// restore from backup or re-create the step
}
} Prevention
- Never hand-edit .ktr files without validating XML afterwards (xmllint or opening in Spoon).
- Keep .ktr files under version control so corrupt edits can be reverted.
- When copying steps between transformations, copy the entire <step> node including all child tags.
When it happens
Trigger: readData(stepnode) called from loadXML when XMLHandler.getTagValue throws or the XML structure is invalid — e.g. corrupt .ktr file, wrong nesting of step node tags, incompatible XML produced by another version.
Common situations: Hand-edited or truncated .ktr files; merging transformations with conflicting XML; loading a .ktr saved by a different Pentaho version with schema drift; copy-paste errors in the step XML block.
Related errors
- AnalyticQueryMeta.Exception.UnableToLoadStepInfoFromXML
- Error_0001
- ERROR_0001
- Error loading transformation executor details from XML
- GetXMLData.Log.UnableCreateDocument (localized message)
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/dce6f68da67aa57e.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompareMeta.java:456
compareSchemaField = XMLHandler.getTagValue( stepnode, "compare_schema_field" );
compareTableField = XMLHandler.getTagValue( stepnode, "compare_table_field" );
keyFieldsField = XMLHandler.getTagValue( stepnode, "key_fields_field" );
excludeFieldsField = XMLHandler.getTagValue( stepnode, "exclude_fields_field" );
nrErrorsField = XMLHandler.getTagValue( stepnode, "nr_errors_field" );
nrRecordsReferenceField = XMLHandler.getTagValue( stepnode, "nr_records_reference_field" );
nrRecordsCompareField = XMLHandler.getTagValue( stepnode, "nr_records_compare_field" );
nrErrorsLeftJoinField = XMLHandler.getTagValue( stepnode, "nr_errors_left_join_field" );
nrErrorsInnerJoinField = XMLHandler.getTagValue( stepnode, "nr_errors_inner_join_field" );
nrErrorsRightJoinField = XMLHandler.getTagValue( stepnode, "nr_errors_right_join_field" );
keyDescriptionField = XMLHandler.getTagValue( stepnode, "key_description_field" );
valueReferenceField = XMLHandler.getTagValue( stepnode, "value_reference_field" );
valueCompareField = XMLHandler.getTagValue( stepnode, "value_compare_field" );
} catch ( Exception e ) {
throw new KettleXMLException( "It was not possibke to load the Trim metadata from XML", e );
}
}
@Override
public String getXML() {
StringBuilder retval = new StringBuilder();
retval.append( " " ).append(
XMLHandler.addTagValue( "reference_connection", referenceConnection == null ? null : referenceConnection
.getName() ) );
retval.append( " " ).append( XMLHandler.addTagValue( "reference_schema_field", referenceSchemaField ) );
retval.append( " " ).append( XMLHandler.addTagValue( "reference_table_field", referenceTableField ) );
retval.append( " " ).append(
XMLHandler.addTagValue( "compare_connection", compareConnection == null ? null : compareConnection
.getName() ) );
retval.append( " " ).append( XMLHandler.addTagValue( "compare_schema_field", compareSchemaField ) );
retval.append( " " ).append( XMLHandler.addTagValue( "compare_table_field", compareTableField ) );View on GitHub (pinned to f3058517a1)