{"record":{"id":"cf58848da39c7a13","repo":"pentaho/pentaho-kettle","slug":"throw-new-kettlestepexception-e-getfilenames","errorCode":null,"errorMessage":"throw new KettleStepException( e );","messagePattern":"throw new KettleStepException\\( e \\);","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/getfilenames/GetFileNames.java","lineNumber":258,"sourceCode":"        // See if we need to add the row number to the row...\n        if ( meta.includeRowNumber() && !Utils.isEmpty( meta.getRowNumberField() ) ) {\n          extraData[outputIndex++] = new Long( data.rownr );\n        }\n\n        data.rownr++;\n        // Add row data\n        outputRow = RowDataUtil.addRowData( outputRow, data.totalpreviousfields, extraData );\n        // Send row\n        putRow( data.outputRowMeta, outputRow );\n\n        if ( meta.getRowLimit() > 0 && data.rownr >= meta.getRowLimit() ) { // limit has been reached: stop now.\n          setOutputDone();\n          return false;\n        }\n\n      }\n    } catch ( Exception e ) {\n      throw new KettleStepException( e );\n    }\n\n    data.filenr++;\n\n    if ( checkFeedback( getLinesInput() ) ) {\n      if ( log.isBasic() ) {\n        logBasic( BaseMessages.getString( PKG, \"GetFileNames.Log.NrLine\", \"\" + getLinesInput() ) );\n      }\n    }\n\n    return true;\n  }\n\n  private void handleMissingFiles() throws KettleException {\n    if ( meta.isdoNotFailIfNoFile() && data.files.nrOfFiles() == 0 ) {\n      logBasic( BaseMessages.getString( PKG, \"GetFileNames.Log.NoFile\" ) );\n      return;\n    }","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/getfilenames/GetFileNames.java#L240-L276","documentation":"The catch-all in processRow: any unexpected Exception thrown while iterating files and building output rows is rethrown as a KettleStepException, aborting the step. The real cause is always in the wrapped exception.","triggerScenarios":"Any non-Kettle exception during per-file processing: VFS resolution errors, null/invalid field values in the filename field, FileSystemException from file operations.","commonSituations":"Malformed filenames in the input field (bad URIs for VFS), unreadable directories, unexpected nulls from input rows, plugin/VFS provider missing.","solutions":["Inspect getCause() of the KettleStepException for the root exception.","Log/preview the incoming filename field values for malformed entries.","Verify VFS provider dependencies (e.g., SFTP/HTTP jars) are present.","Fix the specific file/permission problem indicated by the cause."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  processRow();\n} catch (KettleStepException e) {\n  Throwable root = e; while (root.getCause() != null) root = root.getCause();\n  logError(\"Root cause: \" + root, e);\n  throw e;\n}","preventionTips":["Always inspect the wrapped cause chain","Validate filename field values (valid paths/URIs) upstream","Install required VFS provider dependencies"],"tags":["pentaho","kettle","unexpected-exception","wrapped-cause"],"backgroundTag":"unexpected-response-shape","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"}