prestodb/presto · error · SQLException
No wrapper for
Error message
No wrapper for
What it means
Standard JDBC Wrapper.unwrap() implementation: if isWrapperFor(iface) says this object does not implement or wrap the requested interface, the SQLException 'No wrapper for <iface>' is thrown. It means the caller requested a type this PrestoResultSetMetaData cannot expose.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSetMetaData.java:244
case Types.BLOB:
return Blob.class.getName();
case Types.CLOB:
return Clob.class.getName();
case Types.ARRAY:
return Array.class.getName();
}
return String.class.getName();
}
@SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> iface)
throws SQLException
{
if (isWrapperFor(iface)) {
return (T) this;
}
throw new SQLException("No wrapper for " + iface);
}
@Override
public boolean isWrapperFor(Class<?> iface)
throws SQLException
{
return iface.isInstance(this);
}
private ColumnInfo column(int column)
throws SQLException
{
if ((column <= 0) || (column > columnInfo.size())) {
throw new SQLException("Invalid column index: " + column);
}
return columnInfo.get(column - 1);
}
}View on GitHub (pinned to 55bb57d202)
Solutions
- Unwrap only to interfaces PrestoResultSetMetaData actually implements (e.g. java.sql.ResultSetMetaData) or the concrete PrestoResultSetMetaData class
- Guard with isWrapperFor(iface) before calling unwrap
- Use the JDBC-standard interfaces instead of vendor-specific types
Example fix
// before
MyVendorMeta m = meta.unwrap(MyVendorMeta.class); // throws
// after
if (meta.isWrapperFor(PrestoResultSetMetaData.class)) {
PrestoResultSetMetaData m = meta.unwrap(PrestoResultSetMetaData.class);
} Defensive patterns
Strategy: validation
Validate before calling
if (!meta.isWrapperFor(TargetType.class)) {
throw new IllegalStateException("Metadata does not wrap " + TargetType.class.getName());
} Type guard
boolean usable = iface != null && (iface.isInstance(meta));
Try / catch
try {
T t = meta.unwrap(TargetType.class);
} catch (SQLException e) {
if (e.getMessage() != null && e.getMessage().startsWith("No wrapper for")) {
// use the standard java.sql.ResultSetMetaData interface instead
} else { throw e; }
} Prevention
- Only unwrap to interfaces the object actually implements
- Always call isWrapperFor before unwrap
- Avoid vendor-specific wrapper types when writing driver-agnostic code
When it happens
Trigger: Calling metaData.unwrap(SomeClass.class) where SomeClass is not PrestoResultSetMetaData, not an interface it implements (ResultSetMetaData, Wrapper), and not assignable from the object.
Common situations: Unwrapping to a vendor-specific interface of a different driver (e.g. casting to another JDBC product's class); reflection-based framework code assuming a specific wrapper type; copy-pasted unwrap calls targeting the wrong driver's API class.
Related errors
- TABLE_NOT_FOUND
- No wrapper for
- privileges not supported
- row identifiers not supported
- version columns not supported
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/7c3d162fb99ac92c.
Report an issue: GitHub.