{"record":{"id":"8860efbb02c63656","repo":"pentaho/pentaho-kettle","slug":"namespace-namespace-doesn-t-exist","errorCode":null,"errorMessage":"Namespace '${namespace}' doesn't exist.","messagePattern":"Namespace '(.+?)' doesn't exist\\.","errorType":"exception","errorClass":"MetaStoreException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/metastore/DatabaseMetaStoreUtil.java","lineNumber":110,"sourceCode":"  }\n\n  public static IMetaStoreElementType populateDatabaseElementType( IMetaStore metaStore ) throws MetaStoreException {\n\n    // The new type will typically have an ID so all we need to do is give the type a name and a description.\n    //\n    IMetaStoreElementType elementType = metaStore.newElementType( PentahoDefaults.NAMESPACE );\n\n    // Name and description...\n    //\n    elementType.setName( PentahoDefaults.DATABASE_CONNECTION_ELEMENT_TYPE_NAME );\n    elementType.setDescription( PentahoDefaults.DATABASE_CONNECTION_ELEMENT_TYPE_DESCRIPTION );\n    return elementType;\n  }\n\n  public static IMetaStoreElement populateDatabaseElement( IMetaStore metaStore, DatabaseMeta databaseMeta ) throws MetaStoreException {\n\n    if ( !metaStore.namespaceExists( PentahoDefaults.NAMESPACE ) ) {\n      throw new MetaStoreException( \"Namespace '\" + PentahoDefaults.NAMESPACE + \"' doesn't exist.\" );\n    }\n\n    // If the data type doesn't exist, error out...\n    //\n    IMetaStoreElementType elementType =\n      metaStore.getElementTypeByName(\n        PentahoDefaults.NAMESPACE, PentahoDefaults.DATABASE_CONNECTION_ELEMENT_TYPE_NAME );\n    if ( elementType == null ) {\n      throw new MetaStoreException( \"Unable to find the database connection type\" );\n    }\n\n    elementType = populateDatabaseElementType( metaStore );\n\n    // generate a new database element and populate it with metadata\n    //\n    IMetaStoreElement element = metaStore.newElement( elementType, databaseMeta.getName(), null );\n\n    element.addChild( metaStore.newAttribute( MetaStoreConst.DB_ATTR_ID_PLUGIN_ID, databaseMeta.getPluginId() ) );","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/metastore/DatabaseMetaStoreUtil.java#L92-L128","documentation":"populateDatabaseElement() requires the Pentaho default metastore namespace to exist before storing a database connection. If metaStore.namespaceExists(PentahoDefaults.NAMESPACE) is false it throws this MetaStoreException. The namespace must be created explicitly before persisting connection metadata.","triggerScenarios":"Calling populateDatabaseElement() or databaseElement() on a fresh/empty IMetaStore where the PentahoDefaults.NAMESPACE namespace was never created.","commonSituations":"New in-memory or file metastore used without running initialization code; metastore directory wiped or pointed to a new empty location; custom metastore implementation that does not pre-create namespaces.","solutions":["Create the namespace first: metaStore.createNamespace( PentahoDefaults.NAMESPACE )","Call DatabaseMetaStoreUtil.populateDatabaseElementType() (or equivalent init) which ensures the namespace and element type exist","Point the application at the intended, initialized metastore location"],"exampleFix":"// before\nIMetaStoreElement el = DatabaseMetaStoreUtil.databaseElement( metaStore, dbMeta ); // throws\n// after\nif ( !metaStore.namespaceExists( PentahoDefaults.NAMESPACE ) ) {\n  metaStore.createNamespace( PentahoDefaults.NAMESPACE );\n}\nIMetaStoreElement el = DatabaseMetaStoreUtil.databaseElement( metaStore, dbMeta );","handlingStrategy":"validation","validationCode":"if ( !metaStore.namespaceExists( PentahoDefaults.NAMESPACE ) ) {\n  metaStore.createNamespace( PentahoDefaults.NAMESPACE );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Initialize the metastore namespace at application startup","Check metastore location configuration points at the initialized store","Add an idempotent ensureNamespace() helper"],"tags":["metastore","namespace","initialization"],"backgroundTag":"resource-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"}