pentaho/pentaho-kettle · error · KettleXMLException

Error reading information from input stream

Error message

Error reading information from input stream

What it means

loadXMLFile(URL) wraps any exception raised while opening and parsing an XML document from an InputStream (including closing it) into a KettleXMLException with the fixed message "Error reading information from input stream". The original cause is attached as the exception cause, so the root reason (malformed XML, connection failure, SAX error) lives in e.getCause().

Solutions

  1. Inspect e.getCause() (usually SAXParseException) for the real root problem and its line/column.
  2. Validate the XML file with an XML parser or xmllint before loading.
  3. Check URL reachability (curl the URL) and network/proxy settings.
  4. If the stream is already open in caller code, use loadXMLFile(InputStream) to control the source yourself.

Example fix

// before
try { doc = XMLHandler.loadXMLFile(url); }
catch (KettleXMLException e) { log.error(e.getMessage()); }
// after
try { doc = XMLHandler.loadXMLFile(url); }
catch (KettleXMLException e) {
  Throwable root = e.getCause();
  log.error("XML load failed: " + (root instanceof SAXParseException
    ? "line " + ((SAXParseException) root).getLineNumber() + ": " + root.getMessage()
    : String.valueOf(root)), e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate before load
try (InputStream in = url.openStream()) { /* reachable */ }

Try / catch

try {
  doc = XMLHandler.loadXMLFile(url);
} catch (KettleXMLException e) {
  Throwable root = e.getCause();
  log.error("XML load from " + url + " failed: " + root, e);
}

Prevention

When it happens

Trigger: XMLHandler.loadXMLFile(URL) where the underlying stream throws: unreachable URL, HTTP error responses, malformed/truncated XML causing SAXParseException, DocumentBuilder configuration failure, or IOException during read/close.

Common situations: Loading remote plugin descriptors over a flaky network, corrupted or partially downloaded XML files, XML with encoding declared incorrectly, proxy/firewall blocking the URL.

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/d5a2ae0a2fac30df. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/xml/XMLHandler.java:687

          // make sure we have an ending slash, otherwise the last part will be ignored
          //
          if ( !systemIDwithEndingSlash.endsWith( "/" ) && !systemIDwithEndingSlash.endsWith( "\\" ) ) {
            systemIDwithEndingSlash = systemIDwithEndingSlash.concat( "/" );
          }
          doc = db.parse( inputStream, systemIDwithEndingSlash );
        }
      } catch ( FileNotFoundException ef ) {
        throw new KettleXMLException( ef );
      } finally {
        if ( inputStream != null ) {
          inputStream.close();
        }
      }

      return doc;
    } catch ( Exception e ) {
      throw new KettleXMLException( "Error reading information from input stream", e );
    }
  }

  public static Document loadXMLFile( File resource ) throws KettleXMLException {
    try {
      return loadXMLFile( resource.toURI().toURL() );
    } catch ( MalformedURLException e ) {
      throw new KettleXMLException( e );
    }
  }

  /**
   * Load a file into an XML document
   *
   * @param resource The resource to load into a document
   * @return the Document if all went well, null if an error occured!
   */
  public static Document loadXMLFile( URL resource ) throws KettleXMLException {

View on GitHub (pinned to f3058517a1)