{"record":{"id":"84f96269daec4929","repo":"prestodb/presto","slug":"hive-invalid-metadata-84f962","errorCode":"HIVE_INVALID_METADATA","errorMessage":"Table is missing storage descriptor","messagePattern":"Table is missing storage descriptor","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java","lineNumber":413,"sourceCode":"        if (parameters == null) {\n            parameters = ImmutableMap.of();\n        }\n\n        return Database.builder()\n                .setDatabaseName(database.getName())\n                .setLocation(Optional.ofNullable(database.getLocationUri()))\n                .setOwnerName(ownerName)\n                .setOwnerType(ownerType)\n                .setComment(Optional.ofNullable(database.getDescription()))\n                .setParameters(parameters)\n                .build();\n    }\n\n    public static Table fromMetastoreApiTable(org.apache.hadoop.hive.metastore.api.Table table, ColumnConverter columnConverter)\n    {\n        StorageDescriptor storageDescriptor = table.getSd();\n        if (storageDescriptor == null) {\n            throw new PrestoException(HIVE_INVALID_METADATA, \"Table is missing storage descriptor\");\n        }\n        return fromMetastoreApiTable(table, storageDescriptor.getCols(), columnConverter);\n    }\n\n    public static Table fromMetastoreApiTable(org.apache.hadoop.hive.metastore.api.Table table, List<FieldSchema> schema, ColumnConverter columnConverter)\n    {\n        StorageDescriptor storageDescriptor = table.getSd();\n        if (storageDescriptor == null) {\n            throw new PrestoException(HIVE_INVALID_METADATA, \"Table is missing storage descriptor\");\n        }\n\n        // TODO: remove the table type change after Hive 3.0 update.\n        // Materialized view fetched from Hive Metastore uses TableType.MANAGED_TABLE before Hive 3.0. Cast it back to MATERIALIZED_VIEW here.\n        PrestoTableType tableType = PrestoTableType.optionalValueOf(table.getTableType()).orElse(OTHER);\n        if (table.getParameters() != null && \"true\".equals(table.getParameters().get(PRESTO_MATERIALIZED_VIEW_FLAG))) {\n            checkState(\n                    TableType.MANAGED_TABLE.name().equals(table.getTableType()),\n                    \"Materialized view %s has incorrect table type %s from Metastore.\", table.getTableName(), table.getTableType());","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java#L395-L431","documentation":"fromMetastoreApiTable converts a raw Thrift metastore Table into Presto's Table model and requires a non-null StorageDescriptor; the incoming metastore object lacks one, which is invalid metadata, so this guard fires to prevent building a table without column/location information.","triggerScenarios":"Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java:413 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Repair the table metadata in the Hive metastore so it has a StorageDescriptor (e.g. recreate the table)","Investigate the client or export tool that produced a Table message without a storage descriptor"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}