prestodb/presto · error · IllegalStateException

%s is not a valid table type to be created.

Error message

%s is not a valid table type to be created.

What it means

End of the table-type switch in table creation: the requested table type (from hive.table-type property) is neither EXTERNAL_TABLE, MANAGED_TABLE, nor the other recognized types, so the connector cannot create it.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java:1118

        if (tableType.equals(EXTERNAL_TABLE)) {
            if (!createsOfNonManagedTablesEnabled) {
                throw new PrestoException(NOT_SUPPORTED, "Cannot create non-managed Hive table");
            }
            String externalLocation = getExternalLocation(tableMetadata.getProperties());
            targetPath = MetastoreUtil.getExternalPath(
                    hdfsEnvironment,
                    new HdfsContext(session, schemaName, tableName, externalLocation, true),
                    externalLocation);
        }
        else if (tableType.equals(MANAGED_TABLE) || tableType.equals(MATERIALIZED_VIEW)) {
            LocationHandle locationHandle = locationService.forNewTable(metastore, session, schemaName, tableName, isTempPathRequired(session, bucketProperty, preferredOrderingColumns));
            targetPath = locationService.getQueryWriteInfo(locationHandle).getTargetPath();
            if (getFooterSkipCount(tableMetadata.getProperties()).isPresent()) {
                throw new PrestoException(NOT_SUPPORTED, format("Cannot create non external table with %s property", SKIP_FOOTER_COUNT_KEY));
            }
        }
        else {
            throw new IllegalStateException(format("%s is not a valid table type to be created.", tableType));
        }

        Map<String, String> tableProperties = getEmptyTableProperties(
                tableMetadata,
                new HdfsContext(session, schemaName, tableName, targetPath.toString(), true),
                hiveStorageFormat,
                tableEncryptionProperties);

        return buildTableObject(
                session.getQueryId(),
                schemaName,
                tableName,
                session.getUser(),
                columnHandles,
                hiveStorageFormat,
                partitionedBy,
                bucketProperty,
                preferredOrderingColumns,

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set the table type property to a supported Hive table type
  2. Check spelling of the external/table type property in CREATE TABLE
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java:1118 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/7dab61ea2b890e68. Report an issue: GitHub.