pentaho/pentaho-kettle · error · RuntimeException

Unable to get string content of cell (

Error message

Unable to get string content of cell (

What it means

OdfCell.getContents() wraps any failure while converting an ODF spreadsheet cell to its string representation in a RuntimeException that names the cell's column and row index. The library throws it because the underlying ODFDOM cell value cannot be read or stringified (e.g. corrupt cell data or an ODFDOM internal error). The original exception is preserved as the cause.

Solutions

  1. Open the .ods file in LibreOffice/OpenOffice, fix or delete the problematic cell, and re-save it.
  2. Inspect the wrapped cause (e.getCause()) to identify the underlying ODFDOM failure and address that root cause.
  3. Re-export the spreadsheet from the source application (e.g. save as xlsx or re-save as ods) to normalize cell contents.
  4. Check the odfdom/Pentaho plugin versions for known ODS parsing bugs and upgrade.

Example fix

// before
String content = cell.getContents(); // throws RuntimeException on bad cell
// after
String content;
try {
  content = cell.getContents();
} catch (RuntimeException e) {
  log.logError("Failed to read cell: " + e.getMessage(), e);
  content = null; // or skip the row
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (cell != null && cell.getValue() != null) { /* safe to read contents */ }

Type guard

boolean isReadable(KCell c) { try { return c != null && c.getValue() != null; } catch (RuntimeException e) { return false; } }

Try / catch

try { String s = cell.getContents(); } catch (RuntimeException e) { log.logError("Cell unreadable: " + e.getMessage(), e); /* skip or default */ }

Prevention

When it happens

Trigger: Calling getContents() on a KCell obtained from an ODF sheet (Excel Input step reading an .ods file) when getValue() returns a non-null object whose toString() fails, or when the wrapped ODFDOM cell access throws any Exception.

Common situations: Reading a corrupted or partially-written .ods file; ODFDOM failing to parse an unusual cell type produced by a third-party spreadsheet generator; running with an incompatible odfdom version bundled with the Pentaho distribution.

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

Appendix: source

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

        case EMPTY:
        default:
          return null;
      }
    } catch ( Exception e ) {
      throw new RuntimeException( "Unable to get value of cell ("
        + cell.getColumnIndex() + ", " + cell.getRowIndex() + ")", e );
    }
  }

  public String getContents() {
    try {
      Object value = getValue();
      if ( value == null ) {
        return null;
      }
      return value.toString();
    } catch ( Exception e ) {
      throw new RuntimeException( "Unable to get string content of cell ("
        + cell.getColumnIndex() + ", " + cell.getRowIndex() + ")", e );
    }
  }

  public int getRow() {
    return cell.getRowIndex();
  }
}

View on GitHub (pinned to f3058517a1)