{"record":{"id":"b41e144c87ef6bae","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-all-database-names","errorCode":null,"errorMessage":"Unable to get all database names","messagePattern":"Unable to get all database names","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":1329,"sourceCode":"    } finally {\n      readWriteLock.readLock().unlock();\n    }\n\n    Collections.sort( allFiles );\n    return allFiles;\n  }\n\n  @Override\n  public String[] getDatabaseNames( boolean includeDeleted ) throws KettleException {\n    try {\n      List<RepositoryFile> children = getAllFilesOfType( null, RepositoryObjectType.DATABASE, includeDeleted );\n      List<String> names = new ArrayList<String>( children.size() );\n      for ( RepositoryFile file : children ) {\n        names.add( file.getTitle() );\n      }\n      return names.toArray( new String[ 0 ] );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to get all database names\", e );\n    }\n  }\n\n  /**\n   * Initialize the shared object assembler map with known assemblers\n   */\n  private void initSharedObjectAssemblerMap() {\n    sharedObjectAssemblerMap =\n      new EnumMap<RepositoryObjectType, SharedObjectAssembler<?>>( RepositoryObjectType.class );\n    sharedObjectAssemblerMap.put( RepositoryObjectType.DATABASE, databaseMetaTransformer );\n    sharedObjectAssemblerMap.put( RepositoryObjectType.CLUSTER_SCHEMA, clusterTransformer );\n    sharedObjectAssemblerMap.put( RepositoryObjectType.PARTITION_SCHEMA, partitionSchemaTransformer );\n    sharedObjectAssemblerMap.put( RepositoryObjectType.SLAVE_SERVER, slaveTransformer );\n  }\n\n  public DatabaseDelegate getDatabaseMetaTransformer() {\n    return databaseMetaTransformer;\n  }","sourceCodeStart":1311,"sourceCodeEnd":1347,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L1311-L1347","documentation":"PurRepository.getDatabaseNames(boolean) lists all DATABASE-type repository files and returns their titles. Any exception during the repository file listing is wrapped in a KettleException with this message.","triggerScenarios":"Calling getDatabaseNames(boolean) when the repository backend fails to list children of the databases folder (network outage, deleted folder, insufficient permissions).","commonSituations":"Shared DB connection listing at PDI startup with a broken pentaho repository connection; users without read rights on the shared objects directory.","solutions":["Confirm repository connectivity and authentication before the call.","Verify the shared databases directory exists and is readable by the current repository user.","Check the wrapped cause exception for the root error from the file service.","Catch KettleException and degrade gracefully to an empty list or local metadata."],"exampleFix":"// before\nString[] names = repository.getDatabaseNames(false);\n// after\nString[] names;\ntry {\n  names = repository.getDatabaseNames(false);\n} catch (KettleException e) {\n  logError(\"Could not list repository databases\", e);\n  names = new String[0];\n}","handlingStrategy":"try-catch","validationCode":"if (!repository.isConnected()) throw new IllegalStateException(\"Connect first\");","typeGuard":"boolean ready = repository != null && repository.hasService(IRepositoryService.class);","tryCatchPattern":"try { names = repository.getDatabaseNames(false); } catch (KettleException e) { log.warn(\"cannot list dbs\", e); names = new String[0]; }","preventionTips":["Check repository connection status before listing.","Verify /etc shared folders exist for the repository user.","Always inspect the wrapped cause exception.","Prefer repository explorer verification before programmatic listing."],"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"}