prestodb/presto · error · PrestoException

HIVE_INVALID_ENCRYPTION_METADATA

HIVE_INVALID_ENCRYPTION_METADATA

Error message

Exactly one of table or column settings can be present. Both are present

What it means

TableEncryptionProperties.fromTableProperties invariant: encryption must specify either the table-level encrypt_table key or column-level encrypt_columns, not both; this message documents the both-present branch of that HIVE_INVALID_ENCRYPTION_METADATA check.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/TableEncryptionProperties.java:40

import static com.facebook.presto.hive.EncryptionProperties.ENCRYPT_COLUMNS_KEY;
import static com.facebook.presto.hive.EncryptionProperties.ENCRYPT_TABLE_KEY;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_INVALID_ENCRYPTION_METADATA;
import static com.facebook.presto.hive.HiveTableProperties.ENCRYPT_COLUMNS;
import static com.facebook.presto.hive.HiveTableProperties.ENCRYPT_TABLE;
import static java.util.Objects.requireNonNull;

public abstract class TableEncryptionProperties
{
    private final Optional<String> encryptTable;
    private final Optional<ColumnEncryptionInformation> columnEncryptionInformation;

    protected TableEncryptionProperties(Optional<String> encryptTable, Optional<ColumnEncryptionInformation> columnEncryptionInformation)
    {
        this.encryptTable = requireNonNull(encryptTable, "encryptTable is null");
        this.columnEncryptionInformation = requireNonNull(columnEncryptionInformation, "columnEncryptionInformation is null");

        if (encryptTable.isPresent() && columnEncryptionInformation.isPresent()) {
            throw new PrestoException(HIVE_INVALID_ENCRYPTION_METADATA, "Exactly one of table or column settings can be present. Both are present");
        }
        else if (!encryptTable.isPresent() && !columnEncryptionInformation.isPresent()) {
            throw new PrestoException(HIVE_INVALID_ENCRYPTION_METADATA, "Exactly one of table or column settings can be present. None are present");
        }
    }

    public Optional<String> getEncryptTable()
    {
        return encryptTable;
    }

    public Optional<ColumnEncryptionInformation> getColumnEncryptionInformation()
    {
        return columnEncryptionInformation;
    }

    protected Map<String, String> getFormatSpecificHiveProperties()
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Remove one of encrypt_table or encrypt_columns from the table properties
  2. Keep only the intended encryption granularity
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-hive/src/main/java/com/facebook/presto/hive/TableEncryptionProperties.java:40 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/60d8caa2a7b2e3b2. Report an issue: GitHub.