prestodb/presto · error · PrestoException
HIVE_INVALID_ENCRYPTION_METADATA
HIVE_INVALID_ENCRYPTION_METADATA
Error message
Unknown encryptionMetadata type:
What it means
EncryptionInformation.fromEncryptionMetadata wraps an encryptionMetadata object from the Hive client. It only understands DwrfEncryptionMetadata; any other implementation type causes a HIVE_INVALID_ENCRYPTION_METADATA 'Unknown encryptionMetadata type' error. The library throws this because it cannot map an unrecognized metadata class into its DWRF-specific reader model.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/EncryptionInformation.java:57
{
this.dwrfEncryptionMetadata = requireNonNull(dwrfEncryptionMetadata, "dwrfEncryptionMetadata is null");
}
@JsonProperty
public Optional<DwrfEncryptionMetadata> getDwrfEncryptionMetadata()
{
return dwrfEncryptionMetadata;
}
public static EncryptionInformation fromEncryptionMetadata(EncryptionMetadata encryptionMetadata)
{
requireNonNull(encryptionMetadata, "encryptionMetadata is null");
if (encryptionMetadata instanceof DwrfEncryptionMetadata) {
return new EncryptionInformation(Optional.of((DwrfEncryptionMetadata) encryptionMetadata));
}
throw new PrestoException(HIVE_INVALID_ENCRYPTION_METADATA, "Unknown encryptionMetadata type: " + encryptionMetadata.getClass());
}
@Override
public int hashCode()
{
return hash(dwrfEncryptionMetadata);
}
@Override
public boolean equals(Object obj)
{
if (obj == this) {
return true;
}
if (obj == null || !this.getClass().equals(obj.getClass())) {
return false;
}View on GitHub (pinned to 55bb57d202)
Solutions
- Ensure the metadata object passed in is an instance of DwrfEncryptionMetadata (from presto-hive), not a foreign implementation
- Align Presto and Hive client library versions so the same EncryptionMetadata classes are used
- If a custom encryption metadata type is required, extend EncryptionInformation to handle it instead of routing through this factory
- Check for duplicate/conflicting hive client jars on the classpath causing instanceof to fail
Example fix
// before
EncryptionInformation.fromEncryptionMetadata(myCustomMetadata);
// after
if (myCustomMetadata instanceof DwrfEncryptionMetadata) {
EncryptionInformation.fromEncryptionMetadata(myCustomMetadata);
} else {
throw new IllegalArgumentException("Only DWRF metadata supported: " + myCustomMetadata.getClass());
} Defensive patterns
Strategy: type-guard
Validate before calling
if (!(encryptionMetadata instanceof DwrfEncryptionMetadata)) {
throw new IllegalArgumentException("Unsupported metadata type: " + encryptionMetadata.getClass());
} Type guard
boolean isDwrfMetadata(EncryptionMetadata m) {
return m instanceof DwrfEncryptionMetadata;
} Try / catch
try {
EncryptionInformation info = EncryptionInformation.fromEncryptionMetadata(meta);
} catch (PrestoException e) {
if (e.getMessage().startsWith("Unknown encryptionMetadata type:")) {
// skip encryption handling or convert to DwrfEncryptionMetadata first
}
throw e;
} Prevention
- Convert foreign metadata types to DwrfEncryptionMetadata before the factory call
- Keep Hive client and Presto versions aligned
- Avoid duplicate hive-storage jars on the classpath
When it happens
Trigger: A custom EncryptionMetadata implementation (or a metadata class from a different Hive/Presto version) is passed to fromEncryptionMetadata, e.g. when a storage-format plugin supplies its own encryption metadata type during a split read.
Common situations: Running a custom or patched Hive client that returns a new EncryptionMetadata subclass, version skew between Presto and the Hive metastore/client libraries, or classloader issues loading a different DwrfEncryptionMetadata class.
Related errors
- GENERIC_INTERNAL_ERROR
- HIVE_INVALID_ENCRYPTION_METADATA
- HIVE_INVALID_ENCRYPTION_METADATA
- Expected field to be %s, actual %s (field %s)
- HIVE_UNSUPPORTED_ENCRYPTION_OPERATION
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/0a5e16a330b065d7.
Report an issue: GitHub.