{"record":{"id":"97cf0cd1daf33449","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-all-database-ids","errorCode":null,"errorMessage":"Unable to get all database IDs","messagePattern":"Unable to get all database IDs","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":1151,"sourceCode":"      } else {\n        return null;\n      }\n    } finally {\n      readWriteLock.readLock().unlock();\n    }\n  }\n\n  @Override\n  public ObjectId[] getDatabaseIDs( boolean includeDeleted ) throws KettleException {\n    try {\n      List<RepositoryFile> children = getAllFilesOfType( null, RepositoryObjectType.DATABASE, includeDeleted );\n      List<ObjectId> ids = new ArrayList<ObjectId>( children.size() );\n      for ( RepositoryFile file : children ) {\n        ids.add( new StringObjectId( file.getId().toString() ) );\n      }\n      return ids.toArray( new ObjectId[ 0 ] );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to get all database IDs\", e );\n    }\n  }\n\n  protected List<RepositoryFile> getAllFilesOfType( final ObjectId dirId, final RepositoryObjectType objectType,\n                                                    final boolean includeDeleted ) throws KettleException {\n    return getAllFilesOfType( dirId, Collections.singletonList( objectType ), includeDeleted );\n  }\n\n  protected List<RepositoryFile> getAllFilesOfType( final ObjectId dirId, final List<RepositoryObjectType> objectTypes,\n                                                    final boolean includeDeleted ) throws KettleException {\n\n    List<RepositoryFile> allChildren = new ArrayList<RepositoryFile>();\n    List<RepositoryFile> children = getAllFilesOfType( dirId, objectTypes );\n    allChildren.addAll( children );\n    if ( includeDeleted ) {\n      String dirPath = null;\n      if ( dirId != null ) {\n        // derive path using id","sourceCodeStart":1133,"sourceCodeEnd":1169,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L1133-L1169","documentation":"PurRepository.getDatabaseIDs() lists all repository files of type DATABASE under the shared-objects root and converts their IDs to Kettle ObjectIds. Any failure in the underlying Pentaho Repository (JCR/PUC) file listing or ID conversion is wrapped in a KettleException with this message.","triggerScenarios":"Calling getDatabaseIDs(boolean) when the repository connection fails, the databases folder is missing/corrupt, or the file service throws while listing children.","commonSituations":"PDI spoon connecting to a Pentaho repository with network/auth issues; a pur repository where shared database connections were deleted or the folder permissions deny listing.","solutions":["Verify the pur repository connection is healthy (connect() succeeded, user authenticated).","Check that the /etc/databases (shared databases) area exists in the repository and the user has read permission.","Inspect the cause chain of the KettleException for the underlying PentahoRepositoryException.","Retry after fixing repository/network; fall back to getDatabaseNames() if only names are needed."],"exampleFix":"// before\nList<ObjectId> ids = repository.getDatabaseIDs(false);\n// after\nList<ObjectId> ids;\ntry {\n  ids = repository.getDatabaseIDs(false);\n} catch (KettleException e) {\n  logError(\"Repository unreadable, using empty database list\", e);\n  ids = Collections.emptyList();\n}","handlingStrategy":"try-catch","validationCode":"// ensure connected before listing\nif (!repository.isConnected()) { repository.connect(user, pass); }\nList<RepositoryFile> dbs = repository.getAllFilesOfType? // n/a; verify via repository.exists(folder) if available","typeGuard":"boolean canList = repository != null && repository.isConnected();","tryCatchPattern":"try { ids = repository.getDatabaseIDs(false); } catch (KettleException e) { log.error(\"db id listing failed\", e); ids = new ObjectId[0]; }","preventionTips":["Always connect and verify repository before repository metadata calls.","Log e.getCause() — the KettleException is only a wrapper.","Grant repository users read access to shared settings.","Use PurRepositoryConnector health checks / connection test in Spoon."],"tags":["repository","kettle","pdi","database-metadata"],"backgroundTag":"database-query-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"}