{"record":{"id":"181c9b19a873553b","repo":"pentaho/pentaho-kettle","slug":"unable-to-load-step-info-from-xml-stepsmetricsmeta","errorCode":null,"errorMessage":"Unable to load step info from XML","messagePattern":"Unable to load step info from XML","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetricsMeta.java","lineNumber":237,"sourceCode":"      allocate( nrsteps );\n\n      for ( int i = 0; i < nrsteps; i++ ) {\n        Node fnode = XMLHandler.getSubNodeByNr( steps, \"step\", i );\n        stepName[i] = XMLHandler.getTagValue( fnode, \"name\" );\n        stepCopyNr[i] = XMLHandler.getTagValue( fnode, \"copyNr\" );\n        stepRequired[i] = XMLHandler.getTagValue( fnode, \"stepRequired\" );\n      }\n      stepnamefield = XMLHandler.getTagValue( stepnode, \"stepnamefield\" );\n      stepidfield = XMLHandler.getTagValue( stepnode, \"stepidfield\" );\n      steplinesinputfield = XMLHandler.getTagValue( stepnode, \"steplinesinputfield\" );\n      steplinesoutputfield = XMLHandler.getTagValue( stepnode, \"steplinesoutputfield\" );\n      steplinesreadfield = XMLHandler.getTagValue( stepnode, \"steplinesreadfield\" );\n      steplinesupdatedfield = XMLHandler.getTagValue( stepnode, \"steplinesupdatedfield\" );\n      steplineswrittentfield = XMLHandler.getTagValue( stepnode, \"steplineswrittentfield\" );\n      steplineserrorsfield = XMLHandler.getTagValue( stepnode, \"steplineserrorsfield\" );\n      stepsecondsfield = XMLHandler.getTagValue( stepnode, \"stepsecondsfield\" );\n    } catch ( Exception e ) {\n      throw new KettleXMLException( \"Unable to load step info from XML\", e );\n    }\n  }\n\n  public String getXML() {\n    StringBuilder retval = new StringBuilder();\n\n    retval.append( \"    <steps>\" + Const.CR );\n    for ( int i = 0; i < stepName.length; i++ ) {\n      retval.append( \"      <step>\" + Const.CR );\n      retval.append( \"        \" + XMLHandler.addTagValue( \"name\", stepName[i] ) );\n      retval.append( \"        \" + XMLHandler.addTagValue( \"copyNr\", stepCopyNr[i] ) );\n      retval.append( \"        \" + XMLHandler.addTagValue( \"stepRequired\", stepRequired[i] ) );\n      retval.append( \"        </step>\" + Const.CR );\n    }\n    retval.append( \"      </steps>\" + Const.CR );\n\n    retval.append( \"        \" + XMLHandler.addTagValue( \"stepnamefield\", stepnamefield ) );\n    retval.append( \"        \" + XMLHandler.addTagValue( \"stepidfield\", stepidfield ) );","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetricsMeta.java#L219-L255","documentation":"StepsMetricsMeta.readData parses the step's XML node using XMLHandler; any exception while reading the tags is wrapped in a KettleXMLException with message 'Unable to load step info from XML'. It is thrown when the XML representation of the StepsMetrics step in a .ktr file is malformed or unexpected.","triggerScenarios":"Loading a .ktr transformation file whose <step> node for StepsMetrics contains malformed XML (unclosed tags, wrong nesting), or whose inner structure cannot be parsed by XMLHandler.getTagValue — e.g. hand-edited XML or a file corrupted in transit.","commonSituations":"Hand-editing a .ktr file and breaking XML syntax; truncated download/copy of a transformation file; SVN/Git merge conflicts left in the XML; an older/newer plugin writing XML the current parser chokes on; filename extensions changed but content corrupted.","solutions":["Open the .ktr in an XML editor/validator and fix the malformed <step> node for the StepsMetrics entry.","Restore the transformation file from version control or a backup.","Re-create the StepsMetrics step in Spoon in a fresh transformation and copy its XML into the broken file.","Confirm the file is not truncated by comparing file size with the original.","Check that the kettle XML is not wrapped in merge-conflict markers (<<<<<<< etc.)."],"exampleFix":"// before (broken XML in .ktr)\n<fields>\n  <stepname>Metrics</stepname>\n <steplinesreadfield>read</steplinesread\n// after\n<fields>\n  <stepname>Metrics</stepname>\n  <steplinesreadfield>read</steplinesreadfield>\n</fields>","handlingStrategy":"try-catch","validationCode":"// Validate the .ktr XML before loading\nDocument doc;\ntry {\n  doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( new File( \"trans.ktr\" ) );\n} catch ( SAXException | IOException e ) {\n  throw new IllegalArgumentException( \"Transformation XML is malformed\", e );\n}\n// ensure StepsMetrics step node parses\nNodeList steps = doc.getElementsByTagName( \"step\" );","typeGuard":null,"tryCatchPattern":"try {\n  transMeta = new TransMeta( \"trans.ktr\" );\n} catch ( KettleXMLException e ) {\n  if ( e.getMessage().contains( \"Unable to load step info from XML\" ) ) {\n    // restore from backup / fix XML, then retry once\n    transMeta = new TransMeta( backupPath );\n  } else { throw e; }\n}","preventionTips":["Never hand-edit .ktr files without validating the XML afterwards.","Resolve merge conflicts in transformation files by regenerating in Spoon, not by manual editing.","Keep transformation files in version control and verify integrity after transfers.","Open the file in Spoon and save once to normalize the XML after upgrades."],"tags":["kettle","xml","deserialization","transformation"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}