{"record":{"id":"ce6aa9b859a3cb78","repo":"pentaho/pentaho-kettle","slug":"jsoninputmeta-exception-errorloadingxml","errorCode":"JsonInputMeta.Exception.ErrorLoadingXML","errorMessage":"JsonInputMeta.Exception.ErrorLoadingXML","messagePattern":"JsonInputMeta\\.Exception\\.ErrorLoadingXML","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMeta.java","lineNumber":746,"sourceCode":"        getInputFields()[i] = field;\n      }\n\n      // Is there a limit on the number of rows we process?\n      rowLimit = Const.toLong( XMLHandler.getTagValue( stepnode, \"limit\" ), 0L );\n\n      setInFields( \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, \"IsInFields\" ) ) );\n      isAFile = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, \"IsAFile\" ) );\n      setFieldValue( XMLHandler.getTagValue( stepnode, \"valueField\" ) );\n      setShortFileNameField( XMLHandler.getTagValue( stepnode, \"shortFileFieldName\" ) );\n      setPathField( XMLHandler.getTagValue( stepnode, \"pathFieldName\" ) );\n      setIsHiddenField( XMLHandler.getTagValue( stepnode, \"hiddenFieldName\" ) );\n      setLastModificationDateField( XMLHandler.getTagValue( stepnode, \"lastModificationTimeFieldName\" ) );\n      setUriField( XMLHandler.getTagValue( stepnode, \"uriNameFieldName\" ) );\n      setRootUriField( XMLHandler.getTagValue( stepnode, \"rootUriNameFieldName\" ) );\n      setExtensionField( XMLHandler.getTagValue( stepnode, \"extensionFieldName\" ) );\n      setSizeField( XMLHandler.getTagValue( stepnode, \"sizeFieldName\" ) );\n    } catch ( Exception e ) {\n      throw new KettleXMLException( BaseMessages.getString( PKG, \"JsonInputMeta.Exception.ErrorLoadingXML\", e\n          .toString() ) );\n    }\n  }\n\n  // For backward compatibility: if \"defaultPathLeafToNull\" tag is absent in the step node at all, then we set\n  // defaultPathLeafToNull as default true.\n  private static boolean getDefaultPathLeafToNull( Node stepnode ) {\n    boolean result = true;\n    List<Node> nodes = XMLHandler.getNodes( stepnode, \"defaultPathLeafToNull\" );\n    if ( nodes != null && nodes.size() > 0 ) {\n      result = \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, \"defaultPathLeafToNull\" ) );\n    }\n    return result;\n  }\n\n  // For backward compatibility: if \"includeNulls\" tag is absent in the step node at all, then we set\n  // includeNulls default if KETTLE_JSON_INPUT_INCLUDE_NULLS is set to \"Y\" in kettle.properties\n  // as seen in PDI-19138","sourceCodeStart":728,"sourceCodeEnd":764,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMeta.java#L728-L764","documentation":"KettleXMLException with message key JsonInputMeta.Exception.ErrorLoadingXML, thrown by JsonInputMeta.loadXML when any exception occurs while reading the step's XML definition (getXML tag values for fields, paths, filename/URI fields, etc.). It indicates the step's saved XML in the .ktr is malformed or incompatible with this plugin version.","triggerScenarios":"Loading a transformation where XMLHandler.getTagValue/setters for the JsonInput step node throw (missing nodes, wrong types, e.g. a non-numeric value in a numeric attribute, or structural tag changes between plugin versions).","commonSituations":"Hand-editing a .ktr file; opening a transformation saved by a newer/older PDI version; copy-pasting step XML between transformations and dropping required tags; corruption during version-control merges.","solutions":["Read the wrapped cause (e.toString() appears in the message) to find the offending tag, and fix the XML in the .ktr.","Open the .ktr in Spoon and re-create/re-save the JSON Input step with current plugin defaults.","Compare the step XML against a freshly created JsonInput step's XML and add missing/renamed tags.","Restore the .ktr from version control or backup before the manual edit."],"exampleFix":"// before (broken .ktr step XML)\n<field><name>f</name><path></path></field> <!-- path missing -> NPE -->\n// after\n<field><name>f</name><path>$.data</path><type>String</type></field>","handlingStrategy":"try-catch","validationCode":"// validate the .ktr XML parses and contains the step node before loading\nDocument doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(ktrFile);\nif (doc.getElementsByTagName(\"json_input\").getLength() == 0) throw new IllegalStateException(\"JsonInput step missing\");","typeGuard":null,"tryCatchPattern":"try { transMeta = new TransMeta(ktrPath, rep); }\ncatch (KettleXMLException e) {\n  log.severe(\"Step XML invalid: \" + e.getMessage()); // message includes cause e.toString()\n  throw e;\n}","preventionTips":["Never hand-edit .ktr files; edit through Spoon.","Use the same or newer PDI/plugin version to open transformations.","Version-control .ktr files and review merge conflicts in step XML carefully.","Keep the JSON plugin version consistent between dev and prod."],"tags":["xml","metadata","ktr","serialization"],"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"}