{"record":{"id":"ddee3fbf449b58e1","repo":"pentaho/pentaho-kettle","slug":"failed-to-check-isfile-in-setstartdir","errorCode":null,"errorMessage":"failed to check isFile in setStartDir()","messagePattern":"failed to check isFile in setStartDir\\(\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java","lineNumber":259,"sourceCode":"      fileDialogOperation.setPath( fileObject.isFile() ? filePath : null  );\n    } catch ( FileSystemException fse ) {\n      throw new KettleException( \"failed to check isFile in setPath()\", fse );\n    }\n  }\n\n  void setFilename( FileDialogOperation fileDialogOperation, FileObject fileObject ) throws KettleException {\n    try {\n      fileDialogOperation.setFilename( fileObject.isFile() ? fileObject.getName().getBaseName() : null );\n    } catch ( FileSystemException fse ) {\n      throw new KettleException( \"failed to check isFile in setFilename()\", fse );\n    }\n  }\n\n  void setStartDir( FileDialogOperation fileDialogOperation, FileObject fileObject, String filePath ) throws KettleException {\n    try {\n      fileDialogOperation.setStartDir( fileObject.isFolder() ? filePath : null );\n    } catch ( FileSystemException fse ) {\n      throw new KettleException( \"failed to check isFile in setStartDir()\", fse );\n    }\n  }\n\n  void setProvider( FileDialogOperation op, FileObject initalFile ) {\n    if ( op.getProviderFilter() == null ) {\n      if ( isConnectedToRepository() ) {\n        op.setProvider( ProviderFilterType.REPOSITORY.toString() );\n      } else if ( isConnectionFile( initalFile ) ) {\n        op.setProvider( ProviderFilterType.VFS.toString() );\n      } else if ( \"hc\".equalsIgnoreCase( initalFile.getURI().getScheme() ) ) {\n        op.setProvider( ProviderFilterType.CLUSTERS.toString() );\n      } else {\n        op.setProvider( ProviderFilterType.LOCAL.toString() );\n      }\n    } else if ( op.getProviderFilter().equalsIgnoreCase( ProviderFilterType.DEFAULT.toString() ) ) {\n      if ( isConnectionFile( initalFile ) ) {\n        op.setProvider( ProviderFilterType.VFS.toString() );\n      } else if ( \"hc\".equalsIgnoreCase( initalFile.getURI().getScheme() ) ) {","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java#L241-L277","documentation":"setStartDir() wraps any FileSystemException from FileObject.isFolder() (used to decide the dialog's starting directory) into a KettleException. Like its setFilename() sibling, the failure is raised by the VFS layer when the folder metadata cannot be read. The message text misleadingly says isFile even though it checks isFolder.","triggerScenarios":"constructFileDialogOperation resolving a start directory whose VFS FileObject cannot be queried: unreachable SFTP host, permission-denied share, deleted/nonexistent folder referenced by a saved setting, or corrupt VFS URI.","commonSituations":"A previously remembered 'last directory' no longer exists or is no longer accessible; a mounted network drive went offline; repository-based paths moved after a repo migration.","solutions":["Verify the start-directory path stored/passed exists and is accessible; fall back to a default folder if not.","Check permissions and connectivity for the VFS provider backing that path.","Read the chained FileSystemException cause for the actual VFS failure.","Clear stale saved dialog state (last-used folder) in the Kettle UI settings."],"exampleFix":"// before\nFileObject startDir = KettleVFS.getFileObject( lastUsedDir );\nconstructFileDialogOperation( shell, startDir, lastUsedDir );\n\n// after\nFileObject startDir = KettleVFS.getFileObject( lastUsedDir );\nif ( startDir == null || !startDir.exists() || !startDir.isFolder() ) {\n  startDir = KettleVFS.getFileObject( System.getProperty( \"user.home\" ) );\n}\nconstructFileDialogOperation( shell, startDir, startDir.getName().getURI() );","handlingStrategy":"fallback","validationCode":"FileObject dir = KettleVFS.getFileObject( startDir );\nif ( dir == null || !dir.exists() || !dir.isFolder() ) {\n  startDir = System.getProperty( \"user.home\" );\n}","typeGuard":"boolean isUsableFolder( FileObject fo ) {\n  try { return fo != null && fo.exists() && fo.isFolder(); } catch ( FileSystemException e ) { return false; }\n}","tryCatchPattern":"try {\n  constructFileDialogOperation( shell, fileObject, startDir );\n} catch ( KettleException e ) {\n  log.warn( \"Start dir unavailable, falling back to home\", e );\n  constructFileDialogOperation( shell, null, System.getProperty( \"user.home\" ) );\n}","preventionTips":["Persisted 'last directory' settings should be re-validated each session","Fall back to user.home when saved folders disappear","Avoid saving start dirs on removable/network drives"],"tags":["vfs","file-io","file-dialog","directory"],"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"}