{"record":{"id":"848b0e33df604170","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-zip-filename-to-depth","errorCode":null,"errorMessage":"Unable to get zip filename '...' to depth ...","messagePattern":"Unable to get zip filename '\\.\\.\\.' to depth \\.\\.\\.","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFile.java","lineNumber":753,"sourceCode":"        return filename;\n      }\n      FileObject fileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( filename, this );\n      FileObject folder = fileObject.getParent();\n      String baseName = fileObject.getName().getBaseName();\n      if ( depth == 1 ) {\n        return baseName;\n      }\n      StringBuilder path = new StringBuilder( baseName );\n      int d = 1;\n      while ( d < depth && folder != null ) {\n        path.insert( 0, '/' );\n        path.insert( 0, folder.getName().getBaseName() );\n        folder = folder.getParent();\n        d++;\n      }\n      return path.toString();\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to get zip filename '\" + filename + \"' to depth \" + depth, e );\n    }\n  }\n\n  private boolean checkContainsFile( String realSourceDirectoryOrFile, FileObject[] filelist, boolean isDirectory ) throws FileSystemException {\n    boolean retval = false;\n    for ( int i = 0; i < filelist.length; i++ ) {\n      FileObject file = filelist[i];\n      if ( ( file.exists() && file.getType().equals( FileType.FILE ) ) ) {\n        retval = true;\n      }\n    }\n    return retval;\n  }\n\n  public Result execute( Result previousResult, int nr ) {\n    Result result = previousResult;\n    List<RowMetaAndData> rows = result.getRows();\n","sourceCodeStart":735,"sourceCodeEnd":771,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFile.java#L735-L771","documentation":"JobEntryZipFile.determineZipfilenameForDepth() throws this KettleException when building a zip filename truncated to a requested folder depth fails. Any exception while walking VFS parent folders (e.g. resolving the FileObject or its base name) is wrapped with the filename and requested depth in the message.","triggerScenarios":"Calling processRowFile with a filename that cannot be resolved through VFS, or whose parent chain cannot be walked (invalid URI, file missing, unsupported filesystem scheme, permission problem on getParent()).","commonSituations":"Filenames with special characters or spaces mis-encoded; using an unsupported VFS scheme; the source file/folder deleted between listing and depth computation; network filesystem timeouts (SMB/SFTP).","solutions":["Verify the filename resolves in VFS (try KettleVFS.getFileObject(filename) in a test) and exists","Simplify the path: avoid special characters and confirm the folder depth requested is smaller than the actual path depth","Check permissions on the file and its parent folders","Check the cause exception for VFS/scheme-specific errors (e.g. sftp auth failures)"],"exampleFix":"// before: file missing at processing time\nzipFile.processRowFile( ... \"/data/removed-dir/report.zip\" ... );\n// after: guard existence first\nFileObject fo = KettleVFS.getFileObject( filename );\nif ( fo == null || !fo.exists() ) { throw new KettleException( \"File does not exist: \" + filename ); }\nzipFile.processRowFile( ... filename ... );","handlingStrategy":"try-catch","validationCode":"// check the file resolves and exists before depth-based naming\nFileObject fo = KettleVFS.getFileObject( filename );\nif ( fo == null || !fo.exists() ) {\n  throw new KettleException( \"Cannot resolve file for depth-naming: \" + filename );\n}","typeGuard":"boolean resolvable( String filename ) {\n  try {\n    FileObject fo = KettleVFS.getFileObject( filename );\n    return fo != null && fo.exists();\n  } catch ( Exception e ) { return false; }\n}","tryCatchPattern":"try {\n  String zipName = determineZipfilenameForDepth( filename, depth );\n} catch ( KettleException e ) {\n  logError( \"Could not build zip name for '\" + filename + \"': \" + e.getCause() );\n  // fall back to a sanitized filename or skip this file\n}","preventionTips":["Resolve files through KettleVFS consistently (same scheme/user settings)","Ensure the source file still exists at processing time (no external deletion)","Request depths no larger than the actual path depth","Check filesystem permissions before zipping"],"tags":["filesystem","vfs","pdi","zip"],"backgroundTag":"file-not-found","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"}