{"record":{"id":"08b310a7408b3a9b","repo":"pentaho/pentaho-kettle","slug":"unable-to-update-element-type","errorCode":null,"errorMessage":"Unable to update element type","messagePattern":"Unable to update element type","errorType":"exception","errorClass":"MetaStoreException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java","lineNumber":262,"sourceCode":"        IMetaStoreElementType type = getElementTypeByName( namespace, elementType.getName() );\n        if ( type != null ) {\n          elementTypeId = type.getId();\n        }\n      }\n\n      if ( elementTypeId != null ) {\n        delegate.updateElementType(\n          namespaceId, new LongObjectId( new StringObjectId( elementType.getId() ) ), elementType );\n        repository.commit();\n      } else {\n        throw new MetaStoreException( \"Unable to update element type: no id was provided and the name '\"\n          + elementType.getName() + \"' didn't match\" );\n      }\n    } catch ( MetaStoreException e ) {\n      throw e;\n    } catch ( Exception e ) {\n      repository.rollback();\n      throw new MetaStoreException( \"Unable to update element type\", e );\n    }\n  }\n\n  @Override\n  public void deleteElementType( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException,\n    MetaStoreDependenciesExistsException {\n    try {\n      Collection<RowMetaAndData> elementTypeRows =\n        delegate.getElements( new LongObjectId( new StringObjectId( elementType.getId() ) ) );\n      if ( !elementTypeRows.isEmpty() ) {\n        List<String> dependencies = new ArrayList<String>();\n        for ( RowMetaAndData elementTypeRow : elementTypeRows ) {\n          Long elementTypeId =\n            elementTypeRow.getInteger( KettleDatabaseRepository.FIELD_ELEMENT_TYPE_ID_ELEMENT_TYPE );\n          dependencies.add( Long.toString( elementTypeId ) );\n        }\n        throw new MetaStoreDependenciesExistsException( dependencies, \"The namespace to delete, '\"\n          + namespace + \"' is not empty\" );","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java#L244-L280","documentation":"Generic wrapper thrown by updateElementType when a non-MetaStoreException occurs during the update transaction. The repository is rolled back before throwing, so a failed update leaves no partial changes. The cause carries the real failure (JDBC error, id conversion problem, commit failure, etc.).","triggerScenarios":"Calling updateElementType with a valid id but where delegate.updateElementType or repository.commit() throws — e.g. LongObjectId/StringObjectId conversion failure on a malformed id string, database connection loss, or SQL constraint violation.","commonSituations":"Repository database becomes unreachable mid-transaction; id string in external config was corrupted (not a valid ObjectId); schema mismatch after client/server version drift; concurrent modification locking issues.","solutions":["Inspect e.getCause() for the JDBC/conversion error and address it (connection, schema, id validity).","Confirm elementType.getId() is a valid ObjectId string before calling.","Retry the update once connectivity is restored — rollback guarantees no partial state.","Keep client and repository schema versions aligned (run repository upgrade)."],"exampleFix":"// before\nmetastore.updateElementType(namespace, elementType); // generic failure, silent rollback\n\n// after\ntry {\n  metastore.updateElementType(namespace, elementType);\n} catch (MetaStoreException e) {\n  log.error(\"Update rolled back: \" + e.getCause(), e);\n}","handlingStrategy":"try-catch","validationCode":"if (elementType.getId() == null) {\n  throw new IllegalArgumentException(\"elementType.id required for update\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  metastore.updateElementType(namespace, elementType);\n} catch (MetaStoreException e) {\n  log.error(\"Update rolled back: {}\", e.getCause(), e);\n  // safe to retry after fixing cause\n}","preventionTips":["Validate ObjectId strings before updates","Ensure repository DB connectivity and matching schema versions","Rely on rollback semantics — no partial updates occur"],"tags":["metastore","update","rollback","database"],"backgroundTag":"database-write-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"}