{"record":{"id":"a0e057deec673844","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-list-of-object-names-from-directory","errorCode":null,"errorMessage":"Unable to get list of object names from directory [","messagePattern":"Unable to get list of object names from directory \\[","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":843,"sourceCode":"  public String[] getDirectoryNames( final ObjectId idDirectory ) throws KettleException {\n    try {\n      readWriteLock.readLock().lock();\n      List<RepositoryFile> children;\n      try {\n        children = pur.getChildren( idDirectory.getId() );\n      } finally {\n        readWriteLock.readLock().unlock();\n      }\n\n      List<String> childNames = new ArrayList<String>();\n      for ( RepositoryFile child : children ) {\n        if ( child.isFolder() ) {\n          childNames.add( child.getName() );\n        }\n      }\n      return childNames.toArray( new String[ 0 ] );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to get list of object names from directory [\" + idDirectory + \"]\", e );\n    }\n  }\n\n  @Override\n  public void deleteClusterSchema( ObjectId idCluster ) throws KettleException {\n    permanentlyDeleteSharedObject( idCluster );\n    removeFromSharedObjectCache( RepositoryObjectType.CLUSTER_SCHEMA, idCluster );\n  }\n\n  @Override\n  public void deleteJob( ObjectId idJob ) throws KettleException {\n    deleteFileById( idJob );\n  }\n\n  protected void permanentlyDeleteSharedObject( final ObjectId id ) throws KettleException {\n    try {\n      readWriteLock.writeLock().lock();\n      try {","sourceCodeStart":825,"sourceCodeEnd":861,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L825-L861","documentation":"getDirectoryNames(ObjectId) failed: it reads the children of the given directory and collects names of child folders; any exception in that lookup is wrapped in this KettleException. It indicates the child list for the directory could not be retrieved from the PUR repository.","triggerScenarios":"Calling getDirectoryNames(idDirectory) when the underlying directory lookup (getFolderChildren / repo browse) throws — e.g. invalid idDirectory, deleted folder, or PUR service failure.","commonSituations":"Using a stale ObjectId from a previous session after the folder was deleted; browsing a folder the user has no read access to; connection problems with the enterprise repository.","solutions":["Verify idDirectory is valid and the folder still exists before calling getDirectoryNames.","Inspect e.getCause() for the underlying service error (not-found vs permission vs network).","Refresh the directory tree or reload ObjectIds from the current repository state.","Reconnect/re-authenticate to the PUR repository if the session expired."],"exampleFix":"// before\nString[] names = repo.getDirectoryNames(dirId);\n// after\nString[] names = repo.getDirectoryNames(dirId); // guard first:\nif (repo.getRepositoryDirectoryTree().findDirectory(dirId) != null) {\n  names = repo.getDirectoryNames(dirId);\n}","handlingStrategy":"validation","validationCode":"RepositoryDirectoryInterface dir = repo.getRepositoryDirectoryTree().findDirectory(idDirectory);\nif (dir == null) throw new KettleException(\"Directory not found: \" + idDirectory);","typeGuard":"null","tryCatchPattern":"try {\n  return repo.getDirectoryNames(idDirectory);\n} catch (KettleException e) {\n  log.error(\"Listing failed for {}: {}\", idDirectory, e.getCause());\n  return new String[0];\n}","preventionTips":["Resolve fresh directory ids from the current tree, not cached ones.","Confirm read access on the folder before listing.","Handle empty results separately from failures."],"tags":["repository","directory","pentaho","listing"],"backgroundTag":"directory-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"}