{"record":{"id":"4d10d1c2f8b02962","repo":"pentaho/pentaho-kettle","slug":"getxmldata-error-unablereadfile-localized-message","errorCode":null,"errorMessage":"GetXMLData.Error.UnableReadFile (localized message)","messagePattern":"GetXMLData\\.Error\\.UnableReadFile \\(localized message\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java","lineNumber":715,"sourceCode":"  private Object[] getXMLRowPutRowWithErrorhandling() throws KettleException {\n    // Build an empty row based on the meta-data\n    Object[] r;\n    data.errorInRowButContinue = false;\n    try {\n      if ( meta.isInFields() ) {\n        while ( ( data.nodenr >= data.nodesize || data.readrow == null ) ) {\n          if ( !ReadNextString() ) {\n            return null;\n          }\n          if ( data.readrow == null ) {\n            return null;\n          }\n        }\n      }\n\n      r = processPutRow( data.an.get( data.nodenr ) );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"GetXMLData.Error.UnableReadFile\" ), e );\n    }\n\n    return r;\n  }\n\n  private Object[] processPutRow( Node node ) throws KettleException {\n    // Create new row...\n    Object[] outputRowData = buildEmptyRow();\n\n    // Create new row or clone\n    if ( meta.isInFields() ) {\n      System.arraycopy( data.readrow, 0, outputRowData, 0, data.nrReadRow );\n    }\n    try {\n      data.nodenr++;\n\n      // Read fields...\n      for ( int i = 0; i < data.nrInputFields; i++ ) {","sourceCodeStart":697,"sourceCodeEnd":733,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java#L697-L733","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the file named in the chained cause and validate it is well-formed XML (xmllint or an XML validator).","Fix file encoding / BOM issues; ensure the step's encoding setting matches the file.","Verify the 'Loop XPath' and field XPath expressions against the actual document structure.","Enable error handling on the step to route bad files/rows aside instead of failing the transformation."],"exampleFix":"// before: step fails transformation on bad file\nthrow new KettleException( BaseMessages.getString( PKG, \"GetXMLData.Error.UnableReadFile\" ), e );\n// after (user side): attach step error handling to send failures to an error stream","handlingStrategy":"try-catch","validationCode":"// Validate XML well-formedness before feeding to the step\ntry ( InputStream in = new FileInputStream( f ) ) {\n  DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( in );\n} catch ( SAXException | IOException e ) {\n  skipFile( f ); // route bad files to a quarantine folder\n}","typeGuard":null,"tryCatchPattern":"try { trans.execute( null ); } catch ( KettleException e ) { log.error( \"Unable to read XML file: \" + e.getCause(), e ); } // inspect getCause() for the real parse error","preventionTips":["Validate source files are well-formed XML before the transformation runs.","Match the step's encoding setting to the file's actual encoding.","Attach step error handling so corrupt files land in an error stream with the filename."],"tags":["pentaho-kettle","xml","parsing","getxmldata"],"backgroundTag":"file-read-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"}