{"record":{"id":"9b26a337a76097ae","repo":"pentaho/pentaho-kettle","slug":"there-was-an-error-reading-from-sas7bat-file-filename","errorCode":null,"errorMessage":"There was an error reading from SAS7BAT file '{filename}'","messagePattern":"There was an error reading from SAS7BAT file '(.+?)'","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInput.java","lineNumber":216,"sourceCode":"                break;\n              default:\n                throw new RuntimeException( \"Unhandled data type '\" + ValueMetaFactory.getValueMetaName( type ) );\n            }\n          }\n\n          // Convert the data type of the new data to the requested data types\n          //\n          convertData( data.fileLayout, row, data.outputRowMeta );\n\n          // Pass along the row to further steps...\n          //\n          putRow( data.outputRowMeta, row );\n\n          // System.out.println(rowNumber+\" ---- passed row : \"+Arrays.toString(rowData));\n\n          return !isStopped();\n        } catch ( Exception e ) {\n          throw new RuntimeException( \"There was an error reading from SAS7BAT file '\" + filename + \"'\", e );\n        }\n      }\n    } );\n\n    return true;\n  }\n\n  protected void convertData( RowMetaInterface source, Object[] sourceData, RowMetaInterface target ) throws KettleException {\n    int targetIndex = getInputRowMeta().size();\n    for ( int i = 0; i < data.fieldIndexes.size(); i++ ) {\n      int fieldIndex = data.fieldIndexes.get( i );\n      ValueMetaInterface sourceValueMeta = source.getValueMeta( fieldIndex );\n      ValueMetaInterface targetValueMeta = target.getValueMeta( targetIndex );\n      sourceData[targetIndex] = targetValueMeta.convertData( sourceValueMeta, sourceData[targetIndex] );\n\n      targetIndex++;\n    }\n  }","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInput.java#L198-L234","documentation":"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.","triggerScenarios":"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.","commonSituations":"Truncated or corrupted SAS7BAT file; file changed/deleted while the transformation runs; unreadable binary content; a column type the row parser cannot handle.","solutions":["Inspect the chained cause exception (getCause) to find the real root failure.","Verify the file is a complete, uncorrupted SAS7BAT file by opening it in a SAS viewer.","Confirm the file is readable by the Pentaho user (permissions, file not locked/deleted mid-run).","Re-export or repair the source SAS file and re-run the transformation."],"exampleFix":"// before: null\n// after: check the cause: log.error(\"Root cause\", e.getCause()); then fix the underlying file issue","handlingStrategy":"try-catch","validationCode":"// Pre-flight the file before running\nif (!file.exists() || file.length() == 0) throw new IllegalStateException(\"SAS file missing or empty: \" + file);\nif (!canReadHeaderAsSas7bat(file)) throw new IllegalStateException(\"Not a valid SAS7BAT file: \" + file);","typeGuard":null,"tryCatchPattern":"try {\n  // run transformation\n} catch (RuntimeException e) {\n  Throwable root = e;\n  while (root.getCause() != null) root = root.getCause();\n  log.error(\"SAS read failed, root cause\", root);\n  throw e;\n}","preventionTips":["Always inspect getCause() — the message itself only names the file.","Verify file integrity (complete transfer, correct size) before ingestion.","Ensure the Pentaho process has read permission and no other process locks/rewrites the file mid-run."],"tags":["sas","file-read-failed","io","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"}