{"record":{"id":"7d495f1d51288099","repo":"pentaho/pentaho-kettle","slug":"execsqlrow-log-emptysqlfromfile","errorCode":null,"errorMessage":"ExecSQLRow.Log.EmptySQLFromFile","messagePattern":"ExecSQLRow\\.Log\\.EmptySQLFromFile","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRow.java","lineNumber":125,"sourceCode":"      if ( data.indexOfSQLFieldname < 0 ) {\n        data.indexOfSQLFieldname = this.getInputRowMeta().indexOfValue( meta.getSqlFieldName() );\n        if ( data.indexOfSQLFieldname < 0 ) {\n          // The field is unreachable !\n          throw new KettleException( BaseMessages.getString( PKG, \"ExecSQLRow.Exception.CouldnotFindField\", meta\n            .getSqlFieldName() ) );\n        }\n      }\n\n    }\n\n    // get SQL\n    String sql = getInputRowMeta().getString( row, data.indexOfSQLFieldname );\n\n    try {\n      if ( meta.isSqlFromfile() ) {\n        if ( Utils.isEmpty( sql ) ) {\n          // empty filename\n          throw new KettleException( BaseMessages.getString( PKG, \"ExecSQLRow.Log.EmptySQLFromFile\" ) );\n        }\n        if ( log.isDebug() ) {\n          logDebug( BaseMessages.getString( PKG, \"ExecSQLRow.Log.ExecutingSQLFromFile\", sql ) );\n        }\n        data.result = data.db.execStatementsFromFile( getTransMeta().getBowl(), sql, meta.IsSendOneStatement() );\n      } else {\n        if ( log.isDebug() ) {\n          logDebug( BaseMessages.getString( PKG, \"ExecSQLRow.Log.ExecutingSQLScript\" ) + Const.CR + sql );\n        }\n        if ( meta.IsSendOneStatement() ) {\n          data.result = data.db.execStatement( sql );\n        } else {\n          data.result = data.db.execStatements( sql );\n        }\n      }\n\n      RowMetaAndData add =\n        getResultRow( data.result, meta.getUpdateField(), meta.getInsertField(), meta.getDeleteField(), meta","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRow.java#L107-L143","documentation":"KettleException thrown by ExecSQLRow.processRow() when 'SQL from file' is enabled but the value of the SQL field in the current row is empty. Since the value is used as a filename of a script to execute, an empty value means there is nothing to execute. Note the message key is a Log key but it is thrown as a hard error here.","triggerScenarios":"meta.isSqlFromfile() is true and getInputRowMeta().getString(row, indexOfSQLFieldname) returns null or empty string for the incoming row, so Utils.isEmpty(sql) is true before data.db.execStatementsFromFile() is called.","commonSituations":"Source table/CSV has null or blank filename values; filter step missing so empty rows reach the step; sqlFromfile flag enabled accidentally while feeding actual SQL text (not filenames).","solutions":["Add a Filter rows step upstream to drop rows where the filename field is null/empty before the ExecSQLRow step.","Fix the data source so every row contains a valid script filename.","If the field actually contains SQL text (not a filename), disable 'SQL from file' in the step dialog.","Use a Value Mapper / NVL step to substitute a default filename for empty values."],"exampleFix":"// upstream fix: filter nulls before the step\n// Filter rows: filename IS NOT NULL AND filename <> ''\n// or in code ensure non-empty before executing:\nString sql = row.getString(fieldName, \"\");\nif (sql == null || sql.isEmpty()) { throw new IllegalArgumentException(\"empty sql filename\"); }","handlingStrategy":"validation","validationCode":"String filename = row.getString(sqlField, \"\");\nif (filename == null || filename.trim().isEmpty()) {\n  throw new IllegalStateException(\"Row has empty SQL filename; filter it upstream\");\n}","typeGuard":null,"tryCatchPattern":"try { trans.execute(...); } catch (KettleException e) { if (e.getMessage().contains(\"EmptySQLFromFile\")) { log.error(\"empty filename row reached ExecSQLRow\"); } }","preventionTips":["Filter null/empty filename rows upstream","Enable 'SQL from file' only when the field holds filenames","Add NVL/default values for optional filenames"],"tags":["empty-value","sql","file-input","kettle"],"backgroundTag":"empty-required-field","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"}