{"record":{"id":"97860832215f360e","repo":"pentaho/pentaho-kettle","slug":"unable-to-read-row-from-xbase-file","errorCode":null,"errorMessage":"Unable to read row from XBase file","messagePattern":"Unable to read row from XBase file","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBase.java","lineNumber":227,"sourceCode":"            }\n            break;\n          case DBFField.FIELD_TYPE_L: // Logical\n            r[i] = rowobj[i];\n            break;\n          case DBFField.FIELD_TYPE_D: // Date\n            r[i] = rowobj[i];\n            break;\n          /*\n           * case DBFField.FIELD_TYPE_P: // Picture v.setValue( (String)rowobj[i] ); // Set to String at first... break;\n           */\n          default:\n            break;\n        }\n      }\n    } catch ( DBFException e ) {\n      log.logError( \"Unable to read row : \" + e.toString() );\n      error = true;\n      throw new KettleException( \"Unable to read row from XBase file\", e );\n    } catch ( Exception e ) {\n      log.logError( \"Unexpected error while reading row: \" + e.toString() );\n      error = true;\n      throw new KettleException( \"Unable to read row from XBase file\", e );\n    }\n\n    return r;\n  }\n\n  public boolean close() {\n    boolean retval = false;\n    try {\n      if ( inputstream != null ) {\n        inputstream.close();\n      }\n\n      retval = true;\n    } catch ( IOException e ) {","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBase.java#L209-L245","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the .dbf file opens cleanly in dBase-compatible tools; re-export or repair the file if corrupt.","Transfer/serve DBF files in binary mode and confirm file size matches the source.","Check file encoding settings in the XBase Input step match the file's code page.","Ensure no other process holds a write lock on the .dbf (and associated .dbt/.fpt memo files) while the transformation runs.","Inspect the chained cause (KettleException.getCause()) and the logged 'Unable to read row : ...' message for the underlying DBFException detail."],"exampleFix":"// before: reading a possibly corrupt file directly\nXBase xbi = new XBase( log, meta.getEncoding(), file.getPath() );\nObject[] row = xbi.getRow( outputRowMeta );\n\n// after: validate file first and handle failure gracefully\nFile dbf = new File( file.getPath() );\nif ( dbf.length() < 33 || dbf.length() % 33 == 0 && dbf.length() < headerRecordCount ) {\n  throw new KettleException( \"DBF file is truncated or corrupt: \" + file.getPath() );\n}\nObject[] row = xbi.getRow( outputRowMeta );\nif ( row == null ) { /* end of data, not an error */ }","handlingStrategy":"try-catch","validationCode":"File dbf = new File( path );\nif ( !dbf.isFile() || !dbf.canRead() || dbf.length() < 33 ) {\n  throw new IllegalStateException( \"DBF file missing, unreadable, or truncated: \" + path );\n}","typeGuard":null,"tryCatchPattern":"try {\n  Object[] row = xbi.getRow( rowMeta );\n} catch ( KettleException e ) {\n  logError( \"DBF row read failed: \" + e.getCause(), e );\n  // stop the step or skip the file; do not retry blindly against a corrupt file\n}","preventionTips":["Transfer DBF files in binary mode and verify sizes/checksums after transfer.","Validate files open in a dBase viewer before scheduling transformations.","Set the correct encoding in the step dialog per file code page.","Avoid concurrent writers holding locks on the .dbf/.dbt during runs."],"tags":["pdi","xbase","dbf","file-read","data-corruption"],"backgroundTag":"file-read-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}