pentaho/pentaho-kettle · error · RuntimeException

There was an error reading from SAS7BAT file

Error message

There was an error reading from SAS7BAT file '{filename}'

What it means

The row() callback wraps the entire per-row read/conversion logic in a catch-all that rethrows as RuntimeException with this message, chaining the original cause. Any failure while parsing a row from the SAS7BAT file surfaces under this wrapper.

Solutions

  1. Inspect the chained cause exception (getCause) to find the real root failure.
  2. Verify the file is a complete, uncorrupted SAS7BAT file by opening it in a SAS viewer.
  3. Confirm the file is readable by the Pentaho user (permissions, file not locked/deleted mid-run).
  4. Re-export or repair the source SAS file and re-run the transformation.

Example fix

// before: null
// after: check the cause: log.error("Root cause", e.getCause()); then fix the underlying file issue
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight the file before running
if (!file.exists() || file.length() == 0) throw new IllegalStateException("SAS file missing or empty: " + file);
if (!canReadHeaderAsSas7bat(file)) throw new IllegalStateException("Not a valid SAS7BAT file: " + file);

Try / catch

try {
  // run transformation
} catch (RuntimeException e) {
  Throwable root = e;
  while (root.getCause() != null) root = root.getCause();
  log.error("SAS read failed, root cause", root);
  throw e;
}

Prevention

When it happens

Trigger: Any Exception thrown while reading/converting a row in the SAS file reader callback (corrupt data, IO error mid-file, type conversion failure, the 'Unhandled data type' error) is rethrown with this message.

Common situations: Truncated or corrupted SAS7BAT file; file changed/deleted while the transformation runs; unreadable binary content; a column type the row parser cannot handle.

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/9b26a337a76097ae. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInput.java:216

                break;
              default:
                throw new RuntimeException( "Unhandled data type '" + ValueMetaFactory.getValueMetaName( type ) );
            }
          }

          // Convert the data type of the new data to the requested data types
          //
          convertData( data.fileLayout, row, data.outputRowMeta );

          // Pass along the row to further steps...
          //
          putRow( data.outputRowMeta, row );

          // System.out.println(rowNumber+" ---- passed row : "+Arrays.toString(rowData));

          return !isStopped();
        } catch ( Exception e ) {
          throw new RuntimeException( "There was an error reading from SAS7BAT file '" + filename + "'", e );
        }
      }
    } );

    return true;
  }

  protected void convertData( RowMetaInterface source, Object[] sourceData, RowMetaInterface target ) throws KettleException {
    int targetIndex = getInputRowMeta().size();
    for ( int i = 0; i < data.fieldIndexes.size(); i++ ) {
      int fieldIndex = data.fieldIndexes.get( i );
      ValueMetaInterface sourceValueMeta = source.getValueMeta( fieldIndex );
      ValueMetaInterface targetValueMeta = target.getValueMeta( targetIndex );
      sourceData[targetIndex] = targetValueMeta.convertData( sourceValueMeta, sourceData[targetIndex] );

      targetIndex++;
    }
  }

View on GitHub (pinned to f3058517a1)