pentaho/pentaho-kettle · error · KettleException

GetXMLData.Error.UnableReadFile (localized message)

Error message

GetXMLData.Error.UnableReadFile (localized message)

What it means

GetXMLData.getXMLRowPutRowWithErrorhandling wraps any exception thrown while parsing an XML document and extracting the next row in a KettleException with localized message 'GetXMLData.Error.UnableReadFile', chaining the original cause. It indicates the step could not read/parse the XML content for the current node.

Solutions

  1. Open the file named in the chained cause and validate it is well-formed XML (xmllint or an XML validator).
  2. Fix file encoding / BOM issues; ensure the step's encoding setting matches the file.
  3. Verify the 'Loop XPath' and field XPath expressions against the actual document structure.
  4. Enable error handling on the step to route bad files/rows aside instead of failing the transformation.

Example fix

// before: step fails transformation on bad file
throw new KettleException( BaseMessages.getString( PKG, "GetXMLData.Error.UnableReadFile" ), e );
// after (user side): attach step error handling to send failures to an error stream
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate XML well-formedness before feeding to the step
try ( InputStream in = new FileInputStream( f ) ) {
  DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( in );
} catch ( SAXException | IOException e ) {
  skipFile( f ); // route bad files to a quarantine folder
}

Try / catch

try { trans.execute( null ); } catch ( KettleException e ) { log.error( "Unable to read XML file: " + e.getCause(), e ); } // inspect getCause() for the real parse error

Prevention

When it happens

Trigger: getXMLRow / getXMLRowPutRowWithErrorhandling catch block: any Exception from parsing data.an (XPath node list) or from processPutRow for the current node, e.g. malformed XML, XPath evaluation failure, or field extraction failure.

Common situations: Corrupt or truncated XML files, files that are not well-formed XML (HTML, CSV, binary) fed into the step, encoding mismatches, or XPath loop path not matching the document structure.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java:715

  private Object[] getXMLRowPutRowWithErrorhandling() throws KettleException {
    // Build an empty row based on the meta-data
    Object[] r;
    data.errorInRowButContinue = false;
    try {
      if ( meta.isInFields() ) {
        while ( ( data.nodenr >= data.nodesize || data.readrow == null ) ) {
          if ( !ReadNextString() ) {
            return null;
          }
          if ( data.readrow == null ) {
            return null;
          }
        }
      }

      r = processPutRow( data.an.get( data.nodenr ) );
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( PKG, "GetXMLData.Error.UnableReadFile" ), e );
    }

    return r;
  }

  private Object[] processPutRow( Node node ) throws KettleException {
    // Create new row...
    Object[] outputRowData = buildEmptyRow();

    // Create new row or clone
    if ( meta.isInFields() ) {
      System.arraycopy( data.readrow, 0, outputRowData, 0, data.nrReadRow );
    }
    try {
      data.nodenr++;

      // Read fields...
      for ( int i = 0; i < data.nrInputFields; i++ ) {

View on GitHub (pinned to f3058517a1)