{"record":{"id":"64965f740af08b96","repo":"prestodb/presto","slug":"not-supported-64965f","errorCode":"NOT_SUPPORTED","errorMessage":"Table type not supported: ${tableType}","messagePattern":"Table type not supported: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/file/FileHiveMetastore.java","lineNumber":265,"sourceCode":"        // validate table location\n        if (table.getTableType().equals(VIRTUAL_VIEW)) {\n            checkArgument(table.getStorage().getLocation().isEmpty(), \"Storage location for view must be empty\");\n        }\n        else if (table.getTableType().equals(MANAGED_TABLE) || table.getTableType().equals(MATERIALIZED_VIEW)) {\n            if (!tableMetadataDirectory.equals(new Path(table.getStorage().getLocation()))) {\n                throw new PrestoException(HIVE_METASTORE_ERROR, \"Table directory must be \" + tableMetadataDirectory);\n            }\n        }\n        else if (table.getTableType().equals(EXTERNAL_TABLE)) {\n            try {\n                validateExternalLocation(new Path(table.getStorage().getLocation()), catalogDirectory);\n            }\n            catch (IOException e) {\n                throw new PrestoException(HIVE_METASTORE_ERROR, \"Could not validate external location\", e);\n            }\n        }\n        else {\n            throw new PrestoException(NOT_SUPPORTED, \"Table type not supported: \" + table.getTableType());\n        }\n\n        if (!table.getTableType().equals(VIRTUAL_VIEW)) {\n            try {\n                Path tableLocation = new Path(table.getStorage().getLocation());\n                FileSystem fileSystem = hdfsEnvironment.getFileSystem(hdfsContext, tableLocation);\n                if (!fileSystem.isDirectory(tableLocation)) {\n                    throw new PrestoException(HIVE_METASTORE_ERROR, \"Table location is not a directory: \" + tableLocation);\n                }\n                if (!fileSystem.exists(tableLocation)) {\n                    throw new PrestoException(HIVE_METASTORE_ERROR, \"Table directory does not exist: \" + tableLocation);\n                }\n            }\n            catch (IOException e) {\n                throw new PrestoException(HIVE_METASTORE_ERROR, \"Could not validate table location\", e);\n            }\n        }\n","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/file/FileHiveMetastore.java#L247-L283","documentation":"FileHiveMetastore.createTable only supports VIRTUAL_VIEW, MANAGED_TABLE, MATERIALIZED_VIEW, and EXTERNAL_TABLE table types. Any other TableType falls through to the else branch and raises NOT_SUPPORTED naming the type.","triggerScenarios":"Passing a Table with an unusual TableType (e.g. INDEX_TABLE, TEMPORARY_TABLE variants, or a type added by a newer Hive) to createTable via the metastore API.","commonSituations":"Migration tools importing Hive metadata with auxiliary table types; plugins building tables with exotic types; version skew where a newer metastore client emits types this Presto build doesn't know.","solutions":["Change the table to one of the supported types (MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW, MATERIALIZED_VIEW) before calling createTable.","Exclude unsupported table types during import/migration and log them for manual handling.","Upgrade Presto if the type is newly supported in later releases."],"exampleFix":"// before\ntable.setTableType(INDEX_TABLE);\nmetastore.createTable(metastoreContext, table, privileges, null);\n// after\ntable.setTableType(EXTERNAL_TABLE);\nmetastore.createTable(metastoreContext, table, privileges, null);","handlingStrategy":"type-guard","validationCode":"Set<TableType> supported = ImmutableSet.of(VIRTUAL_VIEW, MANAGED_TABLE, MATERIALIZED_VIEW, EXTERNAL_TABLE);\nif (!supported.contains(table.getTableType())) {\n    throw new IllegalArgumentException(\"Unsupported table type for file metastore: \" + table.getTableType());\n}","typeGuard":"boolean isSupportedTableType(Table t) {\n    return ImmutableSet.of(VIRTUAL_VIEW, MANAGED_TABLE, MATERIALIZED_VIEW, EXTERNAL_TABLE).contains(t.getTableType());\n}","tryCatchPattern":"try {\n    metastore.createTable(metastoreContext, table, privileges, constraints);\n} catch (PrestoException e) {\n    if (e.getErrorCode() == NOT_SUPPORTED.toErrorCode()) {\n        // fall back to EXTERNAL_TABLE or skip and record the unsupported type\n    } else { throw e; }\n}","preventionTips":["Filter to supported TableTypes in import/migration tools.","Guard createTable wrappers with a type allowlist.","Track metastore version for newly supported types."],"tags":["hive","metastore","table-type","not-supported"],"backgroundTag":"unsupported-table-type","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}