{"record":{"id":"c481f74e0bf13725","repo":"pentaho/pentaho-kettle","slug":"unable-to-load-step-info-from-xml-jsonoutputmeta","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":"plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutputMeta.java","lineNumber":298,"sourceCode":"      dateInFilename = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, \"file\", \"add_date\" ) );\n      timeInFilename = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, \"file\", \"add_time\" ) );\n      DoNotOpenNewFileInit = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, \"file\", \"DoNotOpenNewFileInit\" ) );\n      servletOutput = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, \"file\", \"servlet_output\" ) );\n\n      Node fields = XMLHandler.getSubNode( stepnode, \"fields\" );\n      int nrfields = XMLHandler.countNodes( fields, \"field\" );\n\n      allocate( nrfields );\n\n      for ( int i = 0; i < nrfields; i++ ) {\n        Node fnode = XMLHandler.getSubNodeByNr( fields, \"field\", i );\n\n        outputFields[i] = new JsonOutputField();\n        outputFields[i].setFieldName( XMLHandler.getTagValue( fnode, \"name\" ) );\n        outputFields[i].setElementName( XMLHandler.getTagValue( fnode, \"element\" ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleXMLException( \"Unable to load step info from XML\", e );\n    }\n  }\n\n  public void setDefault() {\n    encoding = Const.XML_ENCODING;\n    outputValue = \"outputValue\";\n    jsonBloc = \"data\";\n    nrRowsInBloc = \"1\";\n    operationType = OPERATION_TYPE_WRITE_TO_FILE;\n    extension = \"js\";\n    int nrfields = 0;\n\n    allocate( nrfields );\n\n    for ( int i = 0; i < nrfields; i++ ) {\n      outputFields[i] = new JsonOutputField();\n      outputFields[i].setFieldName( \"field\" + i );\n      outputFields[i].setElementName( \"field\" + i );","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutputMeta.java#L280-L316","documentation":"JsonOutputMeta.readData parses the step's XML definition (<fields> nodes, encoding, output value, etc.) with XMLHandler; any exception during parsing is rethrown as a KettleXMLException 'Unable to load step info from XML'. This happens when a transformation (.ktr) file's JSON Output step XML is malformed or incompatible.","triggerScenarios":"loadXML calls readData on a Node whose expected tags are missing/corrupt, or XMLHandler throws while reading them (bad XML structure, incompatible plugin version producing unexpected layout).","commonSituations":"Hand-edited or corrupted .ktr file; opening a transformation created by a newer/older PDI version; partial file from a failed save or bad merge; repository object XML truncated.","solutions":["Open the .ktr in a text editor and inspect the <step type=\"JsonOutput\"> block for malformed or missing XML tags.","Restore the transformation from version control or repository history.","Recreate the JSON Output step in Spoon and re-configure its fields.","Upgrade/align the PDI and JSON plugin versions so the XML schema matches."],"exampleFix":"// before (corrupt ktr XML)\n<field><name>foo<element>foo</field>\n// after\n<field><name>foo</name><element>foo</element></field>","handlingStrategy":"try-catch","validationCode":"// Validate the ktr XML before loading\nDocumentBuilderFactory f = DocumentBuilderFactory.newInstance();\nDocument doc = f.newDocumentBuilder().parse(new File(\"trans.ktr\"));\nNodeList steps = doc.getElementsByTagName(\"step\");\nfor (int i = 0; i < steps.getLength(); i++) {\n  if (\"JsonOutput\".equals(steps.item(i).getAttributes().getNamedItem(\"type\").getNodeValue())) {\n    if (((Element) steps.item(i)).getElementsByTagName(\"fields\").getLength() == 0)\n      throw new IllegalStateException(\"JsonOutput step missing <fields> block\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try { transMeta = new TransMeta(\"trans.ktr\"); } catch (KettleXMLException e) {\n  if (e.getMessage().contains(\"Unable to load step info from XML\")) {\n    log.error(\"Corrupt/incompatible .ktr; restore from VCS or recreate the step\", e);\n  }\n  throw e;\n}","preventionTips":["Never hand-edit .ktr files; use Spoon.","Keep .ktr files in version control so corruption is recoverable.","Align PDI/plugin versions across environments before moving transformations."],"tags":["pdi","xml","ktr","serialization","kettle"],"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"}