{"record":{"id":"a0c8d9e7f6c13c33","repo":"pentaho/pentaho-kettle","slug":"the-shared-objects-metadata-store-doesn-t-support-creating-a0c8d9","errorCode":null,"errorMessage":"The shared objects metadata store doesn't support creating new element types","messagePattern":"The shared objects metadata store doesn't support creating new element types","errorType":"exception","errorClass":"MetaStoreException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/shared/SharedObjectsMetaStore.java","lineNumber":101,"sourceCode":"      return databaseElementType;\n    }\n    return null;\n  }\n\n  @Override\n  public IMetaStoreElementType getElementTypeByName( String namespace, String elementTypeName ) throws MetaStoreException {\n    for ( IMetaStoreElementType elementType : getElementTypes( namespace ) ) {\n      if ( elementType.getName() != null && elementType.getName().equalsIgnoreCase( elementTypeName ) ) {\n        return elementType;\n      }\n    }\n    return null;\n  }\n\n  @Override\n  public void createElementType( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException,\n    MetaStoreElementTypeExistsException {\n    throw new MetaStoreException( \"The shared objects metadata store doesn't support creating new element types\" );\n  }\n\n  @Override\n  public void updateElementType( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException {\n    throw new MetaStoreException( \"The shared objects metadata store doesn't support updating element types\" );\n  }\n\n  @Override\n  public void deleteElementType( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException,\n    MetaStoreDependenciesExistsException {\n    throw new MetaStoreException( \"The shared objects metadata store doesn't support deleting element types\" );\n  }\n\n  @Override\n  public List<IMetaStoreElement> getElements( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException {\n    List<IMetaStoreElement> list = new ArrayList<IMetaStoreElement>();\n    for ( SharedObjectInterface sharedObject : sharedObjects.getObjectsMap().values() ) {\n      // The databases...","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/shared/SharedObjectsMetaStore.java#L83-L119","documentation":"SharedObjectsMetaStore derives element types from fixed defaults (e.g. the database element type); users cannot register new element types, so createElementType() always throws MetaStoreException. The set of element types is fixed by what the shared-objects file can represent.","triggerScenarios":"Any call to SharedObjectsMetaStore.createElementType(namespace, elementType), e.g. generic metastore provisioning of custom element types.","commonSituations":"Porting code that used MemoryMetaStore to define custom types (governance metadata, custom models) to the shared-objects metastore; plugins assuming a fully writable metastore.","solutions":["Do not create custom element types in the shared-objects metastore; use the built-in types returned by getElementTypes","Switch to MemoryMetaStore, PentahoMetaStore, or a database metastore for custom types","Restructure code to detect an unwritable metastore and skip type creation"],"exampleFix":"// before\nmetaStore.createElementType( ns, myType );\n// after\nif ( metaStore instanceof SharedObjectsMetaStore ) {\n  throw new IllegalArgumentException( \"Custom element types unsupported; use built-in types\" );\n}\nmetaStore.createElementType( ns, myType );","handlingStrategy":"validation","validationCode":"boolean supportsCustomTypes = !( metaStore instanceof SharedObjectsMetaStore );\nif ( !supportsCustomTypes ) {\n  // verify the type already exists instead of creating it\n  boolean exists = metaStore.getElementTypes( namespace ).stream()\n    .anyMatch( t -> t.getName().equals( elementType.getName() ) );\n}","typeGuard":"boolean isReadOnlyTypeStore = metaStore instanceof SharedObjectsMetaStore;","tryCatchPattern":"try {\n  metaStore.createElementType( ns, type );\n} catch ( MetaStoreException e ) {\n  logger.warn( \"Cannot create element type {} in this metastore; using built-in types\", type.getName() );\n}","preventionTips":["Discover existing types with getElementTypes() instead of creating new ones","Route custom-type storage to MemoryMetaStore or a DB-backed metastore","Design plugins to degrade gracefully when the metastore is type-locked"],"tags":["metastore","unsupported-operation","pdi"],"backgroundTag":"unsupported-operation","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"}