pentaho/pentaho-kettle · error · KettleXMLException

JsonInputMeta.Exception.ErrorLoadingXML

JsonInputMeta.Exception.ErrorLoadingXML

Error message

JsonInputMeta.Exception.ErrorLoadingXML

What it means

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.

Solutions

  1. Read the wrapped cause (e.toString() appears in the message) to find the offending tag, and fix the XML in the .ktr.
  2. Open the .ktr in Spoon and re-create/re-save the JSON Input step with current plugin defaults.
  3. Compare the step XML against a freshly created JsonInput step's XML and add missing/renamed tags.
  4. Restore the .ktr from version control or backup before the manual edit.

Example fix

// before (broken .ktr step XML)
<field><name>f</name><path></path></field> <!-- path missing -> NPE -->
// after
<field><name>f</name><path>$.data</path><type>String</type></field>
Defensive patterns

Strategy: try-catch

Validate before calling

// validate the .ktr XML parses and contains the step node before loading
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(ktrFile);
if (doc.getElementsByTagName("json_input").getLength() == 0) throw new IllegalStateException("JsonInput step missing");

Try / catch

try { transMeta = new TransMeta(ktrPath, rep); }
catch (KettleXMLException e) {
  log.severe("Step XML invalid: " + e.getMessage()); // message includes cause e.toString()
  throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/ce6aa9b859a3cb78. Report an issue: GitHub.

Appendix: source

Thrown at plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMeta.java:746

        getInputFields()[i] = field;
      }

      // Is there a limit on the number of rows we process?
      rowLimit = Const.toLong( XMLHandler.getTagValue( stepnode, "limit" ), 0L );

      setInFields( "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "IsInFields" ) ) );
      isAFile = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "IsAFile" ) );
      setFieldValue( XMLHandler.getTagValue( stepnode, "valueField" ) );
      setShortFileNameField( XMLHandler.getTagValue( stepnode, "shortFileFieldName" ) );
      setPathField( XMLHandler.getTagValue( stepnode, "pathFieldName" ) );
      setIsHiddenField( XMLHandler.getTagValue( stepnode, "hiddenFieldName" ) );
      setLastModificationDateField( XMLHandler.getTagValue( stepnode, "lastModificationTimeFieldName" ) );
      setUriField( XMLHandler.getTagValue( stepnode, "uriNameFieldName" ) );
      setRootUriField( XMLHandler.getTagValue( stepnode, "rootUriNameFieldName" ) );
      setExtensionField( XMLHandler.getTagValue( stepnode, "extensionFieldName" ) );
      setSizeField( XMLHandler.getTagValue( stepnode, "sizeFieldName" ) );
    } catch ( Exception e ) {
      throw new KettleXMLException( BaseMessages.getString( PKG, "JsonInputMeta.Exception.ErrorLoadingXML", e
          .toString() ) );
    }
  }

  // For backward compatibility: if "defaultPathLeafToNull" tag is absent in the step node at all, then we set
  // defaultPathLeafToNull as default true.
  private static boolean getDefaultPathLeafToNull( Node stepnode ) {
    boolean result = true;
    List<Node> nodes = XMLHandler.getNodes( stepnode, "defaultPathLeafToNull" );
    if ( nodes != null && nodes.size() > 0 ) {
      result = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "defaultPathLeafToNull" ) );
    }
    return result;
  }

  // For backward compatibility: if "includeNulls" tag is absent in the step node at all, then we set
  // includeNulls default if KETTLE_JSON_INPUT_INCLUDE_NULLS is set to "Y" in kettle.properties
  // as seen in PDI-19138

View on GitHub (pinned to f3058517a1)