{"record":{"id":"2372af55f01cb788","repo":"prestodb/presto","slug":"iceberg-invalid-metadata-2372af","errorCode":"ICEBERG_INVALID_METADATA","errorMessage":"Table is missing [%s] property: %s","messagePattern":"Table is missing \\[(.+?)\\] property: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/HiveTableOperations.java","lineNumber":225,"sourceCode":"    {\n        if (location.isPresent()) {\n            refreshFromMetadataLocation(null);\n            return currentMetadata;\n        }\n\n        Table table = getTable();\n\n        if (!isIcebergTable(table)) {\n            throw new UnknownTableTypeException(\"Not an Iceberg table: \" + getSchemaTableName());\n        }\n\n        if (isPrestoView(table)) {\n            throw new TableNotFoundException(new SchemaTableName(database, tableName));\n        }\n\n        String metadataLocation = table.getParameters().get(METADATA_LOCATION);\n        if (metadataLocation == null) {\n            throw new PrestoException(ICEBERG_INVALID_METADATA, format(\"Table is missing [%s] property: %s\", METADATA_LOCATION, getSchemaTableName()));\n        }\n\n        refreshFromMetadataLocation(metadataLocation);\n\n        return currentMetadata;\n    }\n\n    @Override\n    public void commit(@Nullable TableMetadata base, TableMetadata metadata)\n    {\n        requireNonNull(metadata, \"metadata is null\");\n\n        // if the metadata is already out of date, reject it\n        if (!Objects.equals(base, current())) {\n            throw new CommitFailedException(\"Cannot commit: stale table metadata for %s\", getSchemaTableName());\n        }\n\n        // if the metadata is not changed, return early","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/HiveTableOperations.java#L207-L243","documentation":"Iceberg tables tracked in the Hive metastore must carry the metadata_location property pointing to their current Iceberg metadata JSON. If refresh finds the table is an Iceberg table but the property is absent, it throws ICEBERG_INVALID_METADATA 'Table is missing [metadata_location] property: <schema.table>', because it cannot locate the table metadata to load.","triggerScenarios":"refresh (via current()/metadata()) on an Iceberg-marked Hive table whose parameters lack metadata_location — e.g. partially completed migration, external process stripping table parameters, or a manually created table missing the property.","commonSituations":"Interrupted Hive-to-Iceberg migration, metastore tools/ETL that rewrite table parameters without preserving metadata_location, manual CREATE TABLE mimicking Iceberg without registering metadata, metastore restore losing properties.","solutions":["Set the property to a valid metadata JSON: ALTER TABLE ... SET TBLPROPERTIES ('metadata_location'='hdfs://.../v<N>.metadata.json') using the latest metadata file.","Re-run the migration/conversion that originally registered the table with Iceberg metadata.","Restore table parameters from metastore backup or a snapshot of the table definition.","Audit ETL/metastore-mutating jobs to preserve unknown table parameters."],"exampleFix":"-- before: table params missing metadata_location\n-- after\nALTER TABLE iceberg.db.tbl SET TBLPROPERTIES ('metadata_location'='hdfs:///warehouse/db/tbl/metadata/00042-abc.metadata.json');","handlingStrategy":"validation","validationCode":"Table t = metastore.getTable(db, name);\nString loc = t.getParameters() == null ? null : t.getParameters().get(\"metadata_location\");\nif (loc == null || loc.isEmpty()) {\n  throw new IllegalStateException(\"Table missing metadata_location: \" + db + \".\" + name);\n}","typeGuard":"boolean hasMetadataLocation(Table t) { return t != null && t.getParameters() != null && !Strings.isNullOrEmpty(t.getParameters().get(\"metadata_location\")); }","tryCatchPattern":"try { ops.current(); } catch (PrestoException e) { if (e.getErrorCode().getCode() == ICEBERG_INVALID_METADATA.getCode()) { /* re-run migration or set metadata_location */ } throw e; }","preventionTips":["Never strip unknown table properties in ETL/metastore jobs","Complete migrations atomically — verify metadata_location after conversion","Backup table parameters before metastore restores","Alert on Iceberg tables lacking metadata_location via periodic metastore audits"],"tags":["iceberg","metadata","hive-metastore","missing-property"],"backgroundTag":"missing-metadata-location","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"}