{"record":{"id":"4ec723fbea042bbf","repo":"apache/iceberg","slug":"invalid-hive-object-for-s-s-4ec723","errorCode":null,"errorMessage":"Invalid Hive object for %s.%s","messagePattern":"Invalid Hive object for (.+?)\\.(.+?)","errorType":"exception","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java","lineNumber":206,"sourceCode":"\n      try {\n        persistTable(tbl, updateHiveView, hiveLockEnabled(conf) ? null : baseMetadataLocation);\n        lock.ensureActive();\n\n        commitStatus = CommitStatus.SUCCESS;\n      } catch (LockException le) {\n        commitStatus = CommitStatus.UNKNOWN;\n        throw new CommitStateUnknownException(\n            \"Failed to heartbeat for hive lock while \"\n                + \"committing changes. This can lead to a concurrent commit attempt be able to overwrite this commit. \"\n                + \"Please check the commit history. If you are running into this issue, try reducing \"\n                + \"iceberg.hive.lock-heartbeat-interval-ms.\",\n            le);\n      } catch (org.apache.hadoop.hive.metastore.api.AlreadyExistsException e) {\n        throw new AlreadyExistsException(e, \"View already exists: %s.%s\", database, viewName);\n\n      } catch (InvalidObjectException e) {\n        throw new ValidationException(e, \"Invalid Hive object for %s.%s\", database, viewName);\n\n      } catch (CommitFailedException | CommitStateUnknownException e) {\n        throw e;\n\n      } catch (Throwable e) {\n        if (e.getMessage() != null\n            && e.getMessage()\n                .contains(\n                    \"The table has been modified. The parameter value for key '\"\n                        + BaseMetastoreTableOperations.METADATA_LOCATION_PROP\n                        + \"' is\")) {\n          throw new CommitFailedException(\n              e, \"The view %s.%s has been modified concurrently\", database, viewName);\n        }\n\n        if (e.getMessage() != null\n            && e.getMessage().contains(\"Table/View 'HIVE_LOCKS' does not exist\")) {\n          throw new RuntimeException(","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java#L188-L224","documentation":"doCommit maps Hive metastore's InvalidObjectException to Iceberg's ValidationException with \"Invalid Hive object for database.viewName\". The metastore rejected the view metadata as invalid — bad table type, invalid parameters, schema/field issues, or naming violations — so the commit never reached the concurrency stage.","triggerScenarios":"Committing view create/update when HMS throws InvalidObjectException, e.g., malformed table parameters, invalid characters in names, schema fields HMS cannot represent, or metadata that violates HMS validation rules.","commonSituations":"View names or column names with characters HMS disallows; schema types/fields incompatible with the Hive metastore version; corrupted or hand-crafted parameters being persisted; metastore version mismatch with stricter validation.","solutions":["Validate the view and column names against Hive identifier rules (alphanumerics/underscore) and rename if needed.","Check the schema for types or constructs unsupported by your HMS version and simplify or upgrade the metastore.","Inspect the chained cause (getCause()) for HMS's specific validation message and fix the offending field/parameter.","Remove custom/hand-written table parameters that violate HMS validation and set properties through Iceberg APIs only."],"exampleFix":"// before: column name with invalid character for HMS\nview.updateSchema().addColumn(\"order amount\", Types.IntegerType.get()).commit();\n// after\nview.updateSchema().addColumn(\"order_amount\", Types.IntegerType.get()).commit();","handlingStrategy":"validation","validationCode":"// Validate names before committing\nString name = identifier.name();\nif (!name.matches(\"[A-Za-z0-9_]+\")) {\n  throw new IllegalArgumentException(\"View name contains characters HMS rejects: \" + name);\n}\nfor (Types.NestedField f : schema.columns()) {\n  if (!f.name().matches(\"[A-Za-z0-9_]+\")) {\n    throw new IllegalArgumentException(\"Column name not HMS-safe: \" + f.name());\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  view.updateSchema().addColumn(...).commit();\n} catch (ValidationException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Invalid Hive object\")) {\n    // inspect e.getCause() (InvalidObjectException) for HMS's specific complaint\n  } else { throw e; }\n}","preventionTips":["Use Hive-safe identifiers (alphanumerics and underscores) for views and columns.","Test schema types against your HMS version before rollout.","Only set table properties through Iceberg APIs, never hand-crafted metadata.","Keep HMS client/server versions compatible to avoid stricter validation surprises."],"tags":["hive-metastore","validation","view","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}