pentaho/pentaho-kettle · error · KettleException

Unable to read row from XBase file

Error message

Unable to read row from XBase file

What it means

Thrown by XBase.getRow() when reading the next record from an open DBF (dBase) file fails. The catch block for DBFException logs 'Unable to read row', sets the step error flag, and wraps the cause in a KettleException. It means the DBF record data is unreadable — typically corruption, a closed file, or an encoding/field-parsing problem in the underlying DBF library.

Solutions

  1. Verify the .dbf file opens cleanly in dBase-compatible tools; re-export or repair the file if corrupt.
  2. Transfer/serve DBF files in binary mode and confirm file size matches the source.
  3. Check file encoding settings in the XBase Input step match the file's code page.
  4. Ensure no other process holds a write lock on the .dbf (and associated .dbt/.fpt memo files) while the transformation runs.
  5. Inspect the chained cause (KettleException.getCause()) and the logged 'Unable to read row : ...' message for the underlying DBFException detail.

Example fix

// before: reading a possibly corrupt file directly
XBase xbi = new XBase( log, meta.getEncoding(), file.getPath() );
Object[] row = xbi.getRow( outputRowMeta );

// after: validate file first and handle failure gracefully
File dbf = new File( file.getPath() );
if ( dbf.length() < 33 || dbf.length() % 33 == 0 && dbf.length() < headerRecordCount ) {
  throw new KettleException( "DBF file is truncated or corrupt: " + file.getPath() );
}
Object[] row = xbi.getRow( outputRowMeta );
if ( row == null ) { /* end of data, not an error */ }
Defensive patterns

Strategy: try-catch

Validate before calling

File dbf = new File( path );
if ( !dbf.isFile() || !dbf.canRead() || dbf.length() < 33 ) {
  throw new IllegalStateException( "DBF file missing, unreadable, or truncated: " + path );
}

Try / catch

try {
  Object[] row = xbi.getRow( rowMeta );
} catch ( KettleException e ) {
  logError( "DBF row read failed: " + e.getCause(), e );
  // stop the step or skip the file; do not retry blindly against a corrupt file
}

Prevention

When it happens

Trigger: During transformation execution, XBaseInput calls getRow() per record; any DBFException (e.g. malformed record, bad field data, file closed unexpectedly) or any other Exception while the DBF cursor advances triggers this exact message from the DBFException catch branch.

Common situations: Corrupt or truncated .dbf files, files transferred in text mode altering binary content, unsupported character encodings/memo fields, the file being deleted or locked by another process mid-read.

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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBase.java:227

            }
            break;
          case DBFField.FIELD_TYPE_L: // Logical
            r[i] = rowobj[i];
            break;
          case DBFField.FIELD_TYPE_D: // Date
            r[i] = rowobj[i];
            break;
          /*
           * case DBFField.FIELD_TYPE_P: // Picture v.setValue( (String)rowobj[i] ); // Set to String at first... break;
           */
          default:
            break;
        }
      }
    } catch ( DBFException e ) {
      log.logError( "Unable to read row : " + e.toString() );
      error = true;
      throw new KettleException( "Unable to read row from XBase file", e );
    } catch ( Exception e ) {
      log.logError( "Unexpected error while reading row: " + e.toString() );
      error = true;
      throw new KettleException( "Unable to read row from XBase file", e );
    }

    return r;
  }

  public boolean close() {
    boolean retval = false;
    try {
      if ( inputstream != null ) {
        inputstream.close();
      }

      retval = true;
    } catch ( IOException e ) {

View on GitHub (pinned to f3058517a1)