{"record":{"id":"5c8d94504fc6ea6e","repo":"pentaho/pentaho-kettle","slug":"unable-to-verify-if-namespace-namespace-exists","errorCode":null,"errorMessage":"Unable to verify if namespace ''+namespace+'' exists.","messagePattern":"Unable to verify if namespace ''\\+namespace\\+'' exists\\.","errorType":"exception","errorClass":"MetaStoreException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java","lineNumber":128,"sourceCode":"      delegate.deleteNamespace( namespaceId );\n      repository.commit();\n    } catch ( MetaStoreDependenciesExistsException e ) {\n      throw e;\n    } catch ( MetaStoreException e ) {\n      repository.rollback();\n      throw e;\n    } catch ( Exception e ) {\n      repository.rollback();\n      throw new MetaStoreException( \"Unable to delete namespace '\" + namespace + \"'\", e );\n    }\n  }\n\n  @Override\n  public boolean namespaceExists( String namespace ) throws MetaStoreException {\n    try {\n      return delegate.getNamespaceId( namespace ) != null;\n    } catch ( Exception e ) {\n      throw new MetaStoreException( \"Unable to verify if namespace '\" + namespace + \"' exists.\", e );\n    }\n  }\n\n  // Handle the element types\n\n  public void createElementType( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException,\n    MetaStoreElementTypeExistsException {\n    try {\n\n      ObjectId namespaceId = delegate.verifyNamespace( namespace );\n\n      // See if the element already exists in this namespace\n      //\n      IMetaStoreElementType existingType = getElementTypeByName( namespace, elementType.getName() );\n      if ( existingType != null ) {\n        throw new MetaStoreElementTypeExistsException(\n          Arrays.asList( existingType ), \"Can not create element type with id '\"\n            + elementType.getId() + \"' because it already exists\" );","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java#L110-L146","documentation":"namespaceExists() resolves the namespace id via delegate.getNamespaceId(); if that lookup throws any exception, it is wrapped as MetaStoreException('Unable to verify if namespace X exists.', cause). Note this is distinct from returning false — it signals the existence check itself failed, usually due to a database problem.","triggerScenarios":"metastore.namespaceExists(name) when the underlying SQL query against R_NAMESPACE throws (connection failure, schema/table missing, SQL syntax/schema mismatch).","commonSituations":"Repository connection closed or invalid; metastore tables absent because the repository was created by an older Pentaho version; transient DB outage during application startup checks.","solutions":["Check the wrapped cause for the underlying SQL/connection error","Verify the repository connection is open and the metastore schema exists (create/upgrade repository)","Retry after restoring database connectivity"],"exampleFix":"// before\nboolean exists = metaStore.namespaceExists(ns); // throws on DB outage\n// after\nboolean exists;\ntry {\n  exists = metaStore.namespaceExists(ns);\n} catch (MetaStoreException e) {\n  throw new MetaStoreException(\"Cannot reach repository metastore: \" + e.getCause().getMessage(), e);\n}","handlingStrategy":"try-catch","validationCode":"if (repository == null || !repository.isConnected()) throw new IllegalStateException(\"Repository not connected\");","typeGuard":null,"tryCatchPattern":"try { exists = metaStore.namespaceExists(ns); } catch (MetaStoreException e) { throw new MetaStoreException(\"Metastore unreachable: \" + e.getCause().getMessage(), e); }","preventionTips":["Verify repository connectivity before metastore existence checks","Create/upgrade the repository so R_NAMESPACE exists","Treat this error as infrastructure (DB) trouble, not a 'false' answer for existence"],"tags":["metastore","database","namespace","lookup-failed"],"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"}