{"record":{"id":"b5504a9663908af6","repo":"pentaho/pentaho-kettle","slug":"filename-is-missing","errorCode":null,"errorMessage":"Filename is missing!","messagePattern":"Filename is missing!","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/Database.java","lineNumber":5290,"sourceCode":"    this.nrExecutedCommits = nrExecutedCommits;\n  }\n\n  /**\n   * Execute an SQL statement inside a file on the database connection (has to be open)\n   *\n   * @param filename The file that contains SQL to execute\n   * @return a Result object indicating the number of lines read, deleted, inserted, updated, ...\n   * @throws KettleDatabaseException in case anything goes wrong.\n   * @sendSinglestatement send one statement\n   */\n  public Result execStatementsFromFile( Bowl bowl, String filename, boolean sendSinglestatement )\n    throws KettleException {\n    FileObject sqlFile = null;\n    InputStream is = null;\n    InputStreamReader bis = null;\n    try {\n      if ( Utils.isEmpty( filename ) ) {\n        throw new KettleException( \"Filename is missing!\" );\n      }\n      sqlFile = KettleVFS.getInstance( bowl ).getFileObject( filename );\n      if ( !sqlFile.exists() ) {\n        throw new KettleException( \"We can not find file [\" + filename + \"]!\" );\n      }\n\n      is = KettleVFS.getInputStream( sqlFile );\n      bis = new InputStreamReader( new BufferedInputStream( is, 500 ) );\n\n      BufferedReader buff = new BufferedReader( bis );\n      String sLine;\n      StringBuilder sql = new StringBuilder( Const.CR );\n\n      while ( ( sLine = buff.readLine() ) != null ) {\n        if ( Utils.isEmpty( sLine ) ) {\n          sql.append( Const.CR );\n        } else {\n          sql.append( Const.CR ).append( sLine );","sourceCodeStart":5272,"sourceCodeEnd":5308,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/Database.java#L5272-L5308","documentation":"Thrown by the SQL-script execution helper (Database.java:5290, executesStatementsFromFile path) as a plain KettleException when the filename parameter is null or empty. The method runs SQL statements from a file and refuses to proceed without a path. Note it is a KettleException, not KettleDatabaseException.","triggerScenarios":"Calling Database.executesStatementsFromFile(filename, ...) (or the wrapped script-execution method) with filename == null or \"\".","commonSituations":"A transformation/job variable holding the SQL file path was never set (missing parameter); environment variable or internal variable not resolved; hard-coded path removed during refactor; GUI field left blank when building metadata programmatically.","solutions":["Pass a non-empty filename resolved via the environment/variable space (variableSpace.environmentSubstitute(path))","Check Utils.isEmpty(filename) before calling and fail early with a clear message","Verify the job/transform parameter that supplies the SQL script path is defined and populated","If the file is optional, skip the call when the path is blank instead of invoking it","Use KettleVFS to confirm the resolved path exists before execution"],"exampleFix":"// before\ndatabase.executesStatementsFromFile( sqlFilename, true );\n// after\nif ( !Utils.isEmpty( sqlFilename ) ) {\n  String resolved = variableSpace.environmentSubstitute( sqlFilename );\n  database.executesStatementsFromFile( resolved, true );\n}","handlingStrategy":"validation","validationCode":"String resolved = variableSpace.environmentSubstitute( sqlFilename );\nif ( Utils.isEmpty( resolved ) ) {\n  throw new IllegalArgumentException( \"SQL script filename must be provided\" );\n}\nif ( !KettleVFS.getInstance( bowl ).getFileObject( resolved ).exists() ) {\n  throw new IllegalArgumentException( \"SQL script not found: \" + resolved );\n}","typeGuard":null,"tryCatchPattern":"try {\n  database.executesStatementsFromFile( filename, true );\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"Filename is missing\" ) ) {\n    // resolve and repopulate the path variable, then retry\n  } else {\n    throw e;\n  }\n}","preventionTips":["Resolve all file paths through environmentSubstitute before use","Validate required path parameters at job/transform init","Skip the call gracefully when the script path is intentionally blank","Check file existence with KettleVFS before execution"],"tags":["missing-argument","sql-script","file-path","kettle"],"backgroundTag":"missing-required-argument","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"}