pentaho/pentaho-kettle · error · KettleXMLException
It was not possible to load the metadata for this step from…
Error message
It was not possible to load the metadata for this step from XML
What it means
SetValueConstantMeta.readData() (called from loadXML) wraps any exception during XML parsing of the step's fields in a KettleXMLException 'It was not possible to load the metadata for this step from XML'. It indicates the step's XML fragment is malformed or missing expected tags.
Solutions
- Open the .ktr in a text editor and validate the <fields> XML block against a working transformation
- Fix or restore the corrupted XML fragment (compare with a Spoon-generated file)
- Reload the transformation from version control or repository backup
- Re-add and reconfigure the step in Spoon, then save a fresh XML
Example fix
// before (corrupt) <field><replace_value>x</replace_value></field> // after <field><field_name>status</field_name><replace_value>x</replace_value></field>
Defensive patterns
Strategy: try-catch
Validate before calling
org.w3c.dom.Node stepNode = XMLHandler.getSubNode(stepXml, "fields");
if (stepNode == null || XMLHandler.getNodes(stepNode, "field") == null)
throw new IllegalStateException("setvalueconstant XML missing fields block"); Try / catch
try { meta.loadXML(stepNode, databases, metaStore, variables); } catch (KettleXMLException e) { logError("XML load failed for setvalueconstant: " + e.getCause(), e); } Prevention
- Do not hand-edit .ktr XML; edit via Spoon
- Keep transformation files in version control with valid merges
- Validate XML against a known-good transformation after migrations
- Back up .ktr files before bulk edits
When it happens
Trigger: Loading a .ktr file where the setvalueconstant XML block is corrupt — wrong tag structure, nested field nodes missing 'field_name', or an incompatible/older XML shape.
Common situations: Hand-edited transformation files; version migration where tag names changed; truncated files from failed transfers or bad merges.
Related errors
- Unable to load step info from XML
- AppendMeta.Exception.UnableToLoadStepInfo
- AppendMeta.Exception.UnexpectedErrorReadingStepInfo
- CombinationLookupMeta.Exception.UnexpectedErrorWhileReadingS…
- CombinationLookupMeta.Exception.UnableToLoadStepInfo
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/2dfd582a327afff8.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/setvalueconstant/SetValueConstantMeta.java:103
private void readData( Node stepnode, List<DatabaseMeta> databases ) throws KettleXMLException {
try {
usevar = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "usevar" ) );
Node fields = XMLHandler.getSubNode( stepnode, "fields" );
int nrfields = XMLHandler.countNodes( fields, "field" );
List<Field> fieldList = new ArrayList<>();
for ( int i = 0; i < nrfields; i++ ) {
Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );
Field field = new Field();
field.setFieldName( XMLHandler.getTagValue( fnode, "name" ) );
field.setReplaceValue( XMLHandler.getTagValue( fnode, "value" ) );
field.setReplaceMask( XMLHandler.getTagValue( fnode, "mask" ) );
String emptyString = XMLHandler.getTagValue( fnode, "set_empty_string" );
field.setEmptyString( !Utils.isEmpty( emptyString ) && "Y".equalsIgnoreCase( emptyString ) );
fieldList.add( field );
}
setFields( fieldList );
} catch ( Exception e ) {
throw new KettleXMLException( "It was not possible to load the metadata for this step from XML", e );
}
}
public String getXML() {
StringBuilder retval = new StringBuilder();
retval.append( " " + XMLHandler.addTagValue( "usevar", usevar ) );
retval.append( " <fields>" + Const.CR );
fields.forEach( field -> {
retval.append( " <field>" + Const.CR );
retval.append( " " + XMLHandler.addTagValue( "name", field.getFieldName() ) );
retval.append( " " + XMLHandler.addTagValue( "value", field.getReplaceValue() ) );
retval.append( " " + XMLHandler.addTagValue( "mask", field.getReplaceMask() ) );
retval.append( " " + XMLHandler.addTagValue( "set_empty_string", field.isEmptyString() ) );
retval.append( " </field>" + Const.CR );
} );
retval.append( " </fields>" + Const.CR );
return retval.toString();View on GitHub (pinned to f3058517a1)