pentaho/pentaho-kettle · error · KettleException

Unable to read row from file

Error message

Unable to read row from file

What it means

GetFilesRowsCount.getOneRow() wraps any exception while reading the next count/filename values from the currently open file into a KettleException with message 'Unable to read row from file'. It signals the row for the current input file could not be produced, so the step aborts processing.

Solutions

  1. Check the file is readable, not locked, and still exists at processing time.
  2. Verify the configured rows-count field/format matches the file content (e.g. numeric).
  3. Confirm file encoding setting matches the actual file charset.
  4. Inspect the wrapped cause to identify which field or IO step failed.

Example fix

// before
value = Long.parseLong( line ); // NumberFormatException wrapped as this error
// after
try { value = Long.parseLong( line.trim() ); } catch (NumberFormatException nfe) { logBasic("Skipping non-numeric count line: " + line); }
Defensive patterns

Strategy: try-catch

Validate before calling

File f = new File(space.environmentSubstitute(fileName)); if (!f.canRead()) throw new KettleException("File not readable: " + f);

Try / catch

try { row = getOneRow(); } catch (KettleException e) { log.error("Unable to read row from file: " + e.getMessage(), e.getCause()); setErrors(1); stopAll(); }

Prevention

When it happens

Trigger: Called from outputRowData via getOneRow when getRowNumber() throws (malformed row-number field format, IO error reading the file) or building output row r fails (row meta mismatch).

Common situations: File deleted or locked between open and read; configured 'rows count field' value in the file is not parseable as the target type; wrong charset causing garbage values.

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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCount.java:84

        r = RowDataUtil.allocateRowData( data.outputRowMeta.size() );
      }

      if ( meta.isSmartCount() && data.foundData ) {
        // We have data right the last separator,
        // we need to update the row count
        data.rownr++;
      }

      r[data.totalpreviousfields] = data.rownr;

      if ( meta.includeCountFiles() ) {
        r[data.totalpreviousfields + 1] = data.filenr;
      }

      incrementLinesInput();

    } catch ( Exception e ) {
      throw new KettleException( "Unable to read row from file", e );
    }

    return r;
  }

  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {

    try {
      // Grab one row
      Object[] outputRowData = getOneRow();
      if ( outputRowData == null ) {
        setOutputDone(); // signal end to receiver(s)
        return false; // end of data or error.
      }
      if ( ( !meta.isFileField() && data.last_file ) || meta.isFileField() ) {
        putRow( data.outputRowMeta, outputRowData ); // copy row to output rowset(s);
        if ( log.isDetailed() ) {
          logDetailed(

View on GitHub (pinned to f3058517a1)