pentaho/pentaho-kettle · error · KettleException

Unable to determine the layout of SAS7BAT file

Error message

Unable to determine the layout of SAS7BAT file '{filename}'

What it means

The SasInputHelper constructor opens the SAS7BAT file and asks the SAS reader to enumerate columns via the layout callback; if anything fails during that pass, the constructor wraps the exception in a KettleException stating the file layout could not be determined.

Solutions

  1. Check the chained cause for the underlying reader failure.
  2. Verify the file exists, is readable, and is a genuine SAS7BAT file with a valid header.
  3. Open the file in a SAS viewer to confirm it is not corrupt, and re-export if necessary.
  4. Confirm the configured filename/path in the step dialog is correct.

Example fix

// before: filename = "C:/data/export.sas7bdat"; // file actually truncated by partial upload
// after: re-transfer the file fully and verify its size/header before running the transformation
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight before constructing SasInputHelper
if (!file.isFile() || !file.canRead()) throw new IllegalArgumentException("Cannot read file: " + file);
byte[] header = readFirstBytes(file, 8);
if (!isSas7batMagic(header)) throw new IllegalArgumentException("Not a SAS7BAT file: " + file);

Try / catch

try {
  SasInputHelper helper = new SasInputHelper(filename, ...);
} catch (KettleException e) {
  log.error("Layout read failed for " + filename + ", cause:", e.getCause());
  throw e;
}

Prevention

When it happens

Trigger: Any Exception thrown while the SasReader reads column definitions from the file in the SasInputHelper constructor — including SasReaderException from line 78 (value-meta creation) and reader IO/parse errors.

Common situations: File is not actually a valid SAS7BAT file (wrong extension, corrupt header, empty file); file missing or unreadable at path; unsupported SAS file variant; filesystem permission problems.

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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputHelper.java:91

            ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( name, kettleType );
            valueMeta.setLength( kettleLength );
            valueMeta.setComments( label );
            rowMeta.addValueMeta( valueMeta );
          } catch ( Exception e ) {
            throw new SasReaderException( "Unable to create new value meta type", e );
          }
        }

        public boolean readData() {
          return false;
        }

        public boolean row( int rowNumber, Object[] rowData ) {
          return true;
        }
      } );
    } catch ( Exception e ) {
      throw new KettleException( "Unable to determine the layout of SAS7BAT file '" + filename + "'", e );
    }

  }

  @Override
  public String toString() {
    return filename;
  }

  /**
   * @return the filename
   */
  public String getFilename() {
    return filename;
  }

  /**
   * @return the rowMeta

View on GitHub (pinned to f3058517a1)