{"record":{"id":"d9eac76d02a7eaaf","repo":"pentaho/pentaho-kettle","slug":"unable-to-determine-the-layout-of-sas7bat-file-filename","errorCode":null,"errorMessage":"Unable to determine the layout of SAS7BAT file '{filename}'","messagePattern":"Unable to determine the layout of SAS7BAT file '(.+?)'","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputHelper.java","lineNumber":91,"sourceCode":"            ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( name, kettleType );\n            valueMeta.setLength( kettleLength );\n            valueMeta.setComments( label );\n            rowMeta.addValueMeta( valueMeta );\n          } catch ( Exception e ) {\n            throw new SasReaderException( \"Unable to create new value meta type\", e );\n          }\n        }\n\n        public boolean readData() {\n          return false;\n        }\n\n        public boolean row( int rowNumber, Object[] rowData ) {\n          return true;\n        }\n      } );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to determine the layout of SAS7BAT file '\" + filename + \"'\", e );\n    }\n\n  }\n\n  @Override\n  public String toString() {\n    return filename;\n  }\n\n  /**\n   * @return the filename\n   */\n  public String getFilename() {\n    return filename;\n  }\n\n  /**\n   * @return the rowMeta","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputHelper.java#L73-L109","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the chained cause for the underlying reader failure.","Verify the file exists, is readable, and is a genuine SAS7BAT file with a valid header.","Open the file in a SAS viewer to confirm it is not corrupt, and re-export if necessary.","Confirm the configured filename/path in the step dialog is correct."],"exampleFix":"// before: filename = \"C:/data/export.sas7bdat\"; // file actually truncated by partial upload\n// after: re-transfer the file fully and verify its size/header before running the transformation","handlingStrategy":"validation","validationCode":"// Pre-flight before constructing SasInputHelper\nif (!file.isFile() || !file.canRead()) throw new IllegalArgumentException(\"Cannot read file: \" + file);\nbyte[] header = readFirstBytes(file, 8);\nif (!isSas7batMagic(header)) throw new IllegalArgumentException(\"Not a SAS7BAT file: \" + file);","typeGuard":null,"tryCatchPattern":"try {\n  SasInputHelper helper = new SasInputHelper(filename, ...);\n} catch (KettleException e) {\n  log.error(\"Layout read failed for \" + filename + \", cause:\", e.getCause());\n  throw e;\n}","preventionTips":["Verify the file exists, is readable, and has a valid SAS7BAT header before building the helper.","Check getCause() to distinguish corruption from permission/IO problems.","Confirm the SAS file was fully transferred/exported (size checksums on delivery)."],"tags":["sas","file-read-failed","corrupt-file","etl"],"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"}