pentaho/pentaho-kettle · error · KettleException

KettleException( e )

Error message

KettleException( e )

What it means

The OdfWorkbook(String filename, ...) constructor loads an ODF spreadsheet document through KettleVFS and wraps any failure (missing file, I/O error, invalid ODF package) in a KettleException. It is thrown so that Kettle's step framework receives a uniform checked exception with the original cause attached.

Solutions

  1. Verify the file exists at the exact filename/URI and is readable by the Kettle process.
  2. Confirm the file is actually an ODF spreadsheet (.ods); use the POI-based workbook for .xls/.xlsx.
  3. Open and re-save the file in LibreOffice to repair a corrupted package.
  4. Inspect e.getCause() (e.g. FileNotFoundException vs ZipException) to pinpoint whether it is a path or format problem.

Example fix

// before
Workbook wb = new OdfWorkbook(bowl, filename, encoding);
// after
File f = new File(filename);
if (!f.exists() || !f.canRead()) throw new KettleException("Cannot read file: " + filename);
Workbook wb = new OdfWorkbook(bowl, filename, encoding);
Defensive patterns

Strategy: validation

Validate before calling

File f = new File(filename); if (!f.exists() || !f.canRead()) throw new KettleException("Missing/unreadable ODS file: " + filename);

Try / catch

try { wb = new OdfWorkbook(bowl, filename, encoding); } catch (KettleException e) { throw new KettleException("Failed to open ODS '" + filename + "'", e); }

Prevention

When it happens

Trigger: Constructing OdfWorkbook with a filename when OdfSpreadsheetDocument.loadDocument() or KettleVFS.getInputStream() throws any Exception: file not found, unreadable stream, or content that is not a valid ODF spreadsheet.

Common situations: Typo in the spreadsheet path or wrong VFS scheme; file moved/deleted between configuration and execution; feeding an .xls/.xlsx file to the ODS-based reader; a corrupted download.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ods/OdfWorkbook.java:45

import org.pentaho.di.core.spreadsheet.KSheet;
import org.pentaho.di.core.spreadsheet.KWorkbook;
import org.pentaho.di.core.vfs.KettleVFS;

public class OdfWorkbook implements KWorkbook {

  private String filename;
  private String encoding;
  private OdfDocument document;
  private Map<String, OdfSheet> openSheetsMap = new HashMap<String, OdfSheet>();

  public OdfWorkbook( Bowl bowl, String filename, String encoding ) throws KettleException {
    this.filename = filename;
    this.encoding = encoding;

    try {
      document = OdfSpreadsheetDocument.loadDocument( KettleVFS.getInstance( bowl ).getInputStream( filename ) );
    } catch ( Exception e ) {
      throw new KettleException( e );
    }
  }

  public OdfWorkbook( InputStream inputStream, String encoding ) throws KettleException {
    this.encoding = encoding;

    try {
      document = OdfSpreadsheetDocument.loadDocument( inputStream );
    } catch ( Exception e ) {
      throw new KettleException( e );
    }
  }

  public void close() {
    if ( document != null ) {
      document.close();
    }
  }

View on GitHub (pinned to f3058517a1)