{"record":{"id":"fb36f1e6493ebf4d","repo":"prestodb/presto","slug":"iceberg-commit-error","errorCode":"ICEBERG_COMMIT_ERROR","errorMessage":"Failed to acquire locks from metastore because the underlying metastore table 'HIVE_LOCKS' does not exist. This can occur when using an embedded metastore which does not support transactions. To fix this use an alternative metastore.","messagePattern":"Failed to acquire locks from metastore because the underlying metastore table 'HIVE_LOCKS' does not exist\\. This can occur when using an embedded metastore which does not support transactions\\. To fix this use an alternative metastore\\.","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/HiveTableOperations.java","lineNumber":332,"sourceCode":"                }\n                else {\n                    PartitionStatistics tableStats = metastore.getTableStatistics(metastoreContext, database, tableName);\n                    metastore.persistTable(metastoreContext, database, tableName, table, privileges, () -> tableStats, useHMSLock ? ImmutableMap.of() : hmsEnvContext(base.metadataFileLocation()));\n                }\n            }\n            catch (AlreadyExistsException e) {\n                throw new PrestoException(HIVE_METASTORE_ERROR, format(\"Table already exists: %s.%s\", database, tableName), e);\n            }\n            catch (CommitFailedException | CommitStateUnknownException e) {\n                throw e;\n            }\n            catch (Throwable e) {\n                if (e instanceof PrestoException && e.getCause() instanceof InvalidObjectException) {\n                    throw new ValidationException(e, \"Invalid Hive object for %s.%s\", database, tableName);\n                }\n                if (e.getMessage() != null\n                        && e.getMessage().contains(\"Table/View 'HIVE_LOCKS' does not exist\")) {\n                    throw new PrestoException(ICEBERG_COMMIT_ERROR,\n                            \"Failed to acquire locks from metastore because the underlying metastore \"\n                                    + \"table 'HIVE_LOCKS' does not exist. This can occur when using an embedded metastore which does not \"\n                                    + \"support transactions. To fix this use an alternative metastore.\",\n                            e);\n                }\n                CommitStatus commitStatus;\n                if (e.getMessage() != null\n                        && e.getMessage()\n                        .contains(\n                                \"The table has been modified. The parameter value for key '\"\n                                        + METADATA_LOCATION_PROP\n                                        + \"' is\")) {\n                    // It's possible the HMS client incorrectly retries a successful operation, due to network\n                    // issue for example, and triggers this exception. So we need double-check to make sure\n                    // this is really a concurrent modification. Hitting this exception means no pending\n                    // requests, if any, can succeed later, so it's safe to check status in strict mode\n                    commitStatus = checkCommitStatusStrict(newMetadataLocation, metadata);\n                    if (commitStatus == FAILED) {","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/HiveTableOperations.java#L314-L350","documentation":"commit() detects that the underlying failure message contains \"Table/View 'HIVE_LOCKS' does not exist\" and rewraps it as ICEBERG_COMMIT_ERROR with an explanation: the metastore's transactional lock tables are missing, typical of an embedded/non-transactional metastore. The commit could not acquire HMS locks.","triggerScenarios":"Committing to an Iceberg table whose catalog is configured with useHMSLock / transactional Hive locking (hive.support.concurrency=true, LOCK_MANAGER configured) against a metastore lacking the HIVE_LOCKS table (embedded Derby metastore).","commonSituations":"Local/dev setups using embedded metastore with HMS-based locking enabled (iceberg.hive-lock.enabled / hive.metastore lock configuration); test environments copying production config that enables DbLockManager.","solutions":["Use a real (remote, transactional) metastore with a supported database (MySQL/Postgres backed HMS schema) so HIVE_LOCKS exists.","Disable HMS-based locking for the catalog and use an alternative lock provider (e.g. in-process/atomic swap) if transactions are not needed.","If the schema exists, run Hive schematool / initSchema to create the transaction tables."],"exampleFix":"// before (catalog properties)\niceberg.catalog.hive.hive-lock.enabled=true\n// after — with embedded metastore, disable HMS lock\niceberg.catalog.hive.hive-lock.enabled=false","handlingStrategy":"validation","validationCode":"// before enabling HMS lock, verify transaction tables exist\n// run in metastore DB: SHOW TABLES LIKE 'HIVE_LOCKS';","typeGuard":null,"tryCatchPattern":"try { commit(); }\ncatch (PrestoException e) { if (e.getErrorCode() == ICEBERG_COMMIT_ERROR.toErrorCode()) { /* switch to real metastore or disable HMS lock */ } }","preventionTips":["Never enable HMS transactional locking with an embedded metastore.","Init metastore schema with schematool -initSchema so HIVE_LOCKS exists.","Document lock-provider requirements for the catalog."],"tags":["iceberg","hive-metastore","locking","configuration"],"backgroundTag":"hive-locks-table-missing","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}