{"record":{"id":"b6e5326ebec0bd17","repo":"pentaho/pentaho-kettle","slug":"unable-to-load-database-with-id-databaseid","errorCode":null,"errorMessage":"Unable to load database with id [\" + databaseId + \"]","messagePattern":"Unable to load database with id \\[\" \\+ databaseId \\+ \"\\]","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":2416,"sourceCode":"  public DatabaseMeta loadDatabaseMeta( final ObjectId databaseId, final String versionId )\n    throws KettleException {\n    readWriteLock.readLock().lock();\n    try {\n\n      NodeRepositoryFileData\n        data =\n        pur.getDataAtVersionForRead( databaseId.getId(), versionId, NodeRepositoryFileData.class );\n      RepositoryFile file = null;\n\n      if ( versionId != null ) {\n        file = pur.getFileAtVersion( databaseId.getId(), versionId );\n      } else {\n        file = pur.getFileById( databaseId.getId() );\n      }\n\n      return databaseMetaTransformer.assemble( file, data, pur.getVersionSummary( databaseId.getId(), versionId ) );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to load database with id [\" + databaseId + \"]\", e );\n    } finally {\n      readWriteLock.readLock().unlock();\n    }\n  }\n\n  @Override\n  public TransMeta loadTransformation( final String transName, final RepositoryDirectoryInterface parentDir,\n                                       final ProgressMonitorListener monitor, final boolean setInternalVariables,\n                                       final String versionId )\n  throws KettleException {\n    return loadTransformation( this.getBowl(), transName, parentDir, monitor, setInternalVariables, versionId, null );\n  }\n\n  @Override\n  public TransMeta loadTransformation( final Bowl bowl, final String transName, final RepositoryDirectoryInterface parentDir,\n                                       final ProgressMonitorListener monitor, final boolean setInternalVariables,\n                                       final String versionId, VariableSpace parent )\n  throws KettleException {","sourceCodeStart":2398,"sourceCodeEnd":2434,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L2398-L2434","documentation":"Thrown by PurRepository.loadDatabase when loading a DatabaseMeta by ObjectId fails — either the file lookup (getFile/getFileById), data fetch, version summary, or transformation into a DatabaseMeta throws. The original exception is wrapped as a KettleException.","triggerScenarios":"PurRepository.loadDatabase(databaseId, revision, versionLabel) with an ID pointing to a deleted or inaccessible file, or a corrupt/transformer-incompatible repository file.","commonSituations":"Stale ObjectIds cached in Spoon after someone deleted the connection; shared-object cache referencing purged files; repository server temporarily unavailable.","solutions":["Verify the database connection still exists in the repository and refresh shared objects","Re-obtain a fresh ObjectId via repository.getDatabaseID(name)","Check server connectivity and permissions, then retry"],"exampleFix":"// before\nObjectId id = oldCachedId;\nDatabaseMeta db = repository.loadDatabase(id, null, null);\n// after\nObjectId id = repository.getDatabaseID(\"MyConnection\");\nif (id != null) {\n  DatabaseMeta db = repository.loadDatabase(id, null, null);\n}","handlingStrategy":"try-catch","validationCode":"ObjectId id = repository.getDatabaseID(name);\nif (id == null) throw new IllegalStateException(\"Database not found in repository: \" + name);","typeGuard":null,"tryCatchPattern":"try {\n  DatabaseMeta db = repository.loadDatabase(id, null, null);\n} catch (KettleException e) {\n  log.error(\"Failed to load database \" + id + \": \" + e.getCause(), e);\n  // refresh shared object cache and retry\n}","preventionTips":["Always fetch fresh ObjectIds instead of caching across sessions","Refresh the shared-objects cache after other users modify connections","Verify repository connectivity before loading"],"tags":["pentaho","kettle","repository","load-failed"],"backgroundTag":"record-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"}