{"record":{"id":"8896941efd67835d","repo":"pentaho/pentaho-kettle","slug":"unable-to-find-namespace-with-name-namespace","errorCode":null,"errorMessage":"Unable to find namespace with name 'namespace'","messagePattern":"Unable to find namespace with name 'namespace'","errorType":"exception","errorClass":"MetaStoreException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryMetaStoreDelegate.java","lineNumber":68,"sourceCode":"  /**\n   * Retrieve the ID for a namespace\n   *\n   * @param namespace The namespace to look up\n   * @return the ID of the namespace\n   * @throws KettleException\n   */\n  public synchronized LongObjectId getNamespaceId( String namespace ) throws KettleException {\n    return repository.connectionDelegate.getIDWithValue(\n      quoteTable( KettleDatabaseRepository.TABLE_R_NAMESPACE ),\n      quote( KettleDatabaseRepository.FIELD_NAMESPACE_ID_NAMESPACE ),\n      quote( KettleDatabaseRepository.FIELD_NAMESPACE_NAME ), namespace );\n  }\n\n  public ObjectId verifyNamespace( String namespace ) throws MetaStoreException {\n    try {\n      ObjectId namespaceId = getNamespaceId( namespace );\n      if ( namespaceId == null ) {\n        throw new MetaStoreException( \"Unable to find namespace with name '\" + namespace + \"'\" );\n      }\n      return namespaceId;\n    } catch ( KettleException e ) {\n      throw new MetaStoreException( \"Unable to get id of namespace '\" + namespace + \"'\", e );\n    }\n  }\n\n  public synchronized LongObjectId getElementTypeId( LongObjectId namespaceId, String elementTypeName ) throws KettleException {\n    return repository.connectionDelegate.getIDWithValue(\n      quoteTable( KettleDatabaseRepository.TABLE_R_ELEMENT_TYPE ),\n      quote( KettleDatabaseRepository.FIELD_ELEMENT_TYPE_ID_ELEMENT_TYPE ),\n      quote( KettleDatabaseRepository.FIELD_ELEMENT_TYPE_NAME ), elementTypeName,\n      new String[] { quote( KettleDatabaseRepository.FIELD_ELEMENT_TYPE_ID_NAMESPACE ), },\n      new ObjectId[] { namespaceId, } );\n  }\n\n  public synchronized LongObjectId getElementId( LongObjectId elementTypeId, String elementName ) throws KettleException {\n    return repository.connectionDelegate.getIDWithValue(","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryMetaStoreDelegate.java#L50-L86","documentation":"The metastore delegate could not resolve the requested namespace name to an id in the R_ELEMENT_NAMESPACE table, so verifyNamespace throws MetaStoreException. The namespace simply does not exist in the database metastore.","triggerScenarios":"Calling verifyNamespace(namespace) (directly or via element/group type lookups) with a name that was never created, or after the namespace row was deleted.","commonSituations":"Typo in namespace name; metastore pointed at a fresh/empty database; environment migration where namespaces were not exported/imported; case-sensitivity mismatch on the name.","solutions":["Create the namespace first (metastore.createNamespace(namespace)) before verifying/using it","Check the exact namespace spelling/case against R_ELEMENT_NAMESPACE rows","Point the KettleDatabaseRepositoryMetaStore at the database that actually contains the namespace","Export/import metastore content from the source environment if migrating"],"exampleFix":"// before\nObjectId nsId = delegate.verifyNamespace(\"myNamespace\"); // throws if absent\n// after\nif (delegate.getNamespaceId(\"myNamespace\") == null) {\n  metastore.createNamespace(\"myNamespace\");\n}\nObjectId nsId = delegate.verifyNamespace(\"myNamespace\");","handlingStrategy":"validation","validationCode":"if (repository.getMetaStore().getNamespaceId(namespace) == null /* or getNamespaces().contains(namespace) */) {\n  metastore.createNamespace(namespace);\n}","typeGuard":"boolean namespaceExists(IMetaStore store, String ns) { try { return store.getNamespaces().contains(ns); } catch (Exception e) { return false; } }","tryCatchPattern":"try { ObjectId id = delegate.verifyNamespace(ns); } catch (MetaStoreException e) { if (e.getMessage().contains(\"Unable to find namespace\")) delegate.createNamespace(ns); }","preventionTips":["Create namespaces explicitly before use","Treat namespace names as case-sensitive constants","Export/import metastore when moving environments"],"tags":["metastore","namespace","not-found","pentaho"],"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"}