prestodb/presto · error · SQLException
No wrapper for
Error message
No wrapper for
What it means
unwrap(Class) throws SQLException("No wrapper for " + iface) when isWrapperFor(iface) is false — i.e. PrestoConnection neither implements the requested interface nor wraps an object that does. The message includes the offending Class object. This is a local argument/capability failure, not a server issue.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java:703
}
@Override
public int getNetworkTimeout()
throws SQLException
{
checkOpen();
return networkTimeoutMillis.get();
}
@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);
}
URI getURI()
{
return jdbcUri;
}
String getUser()
{
return user;
}View on GitHub (pinned to 55bb57d202)
Solutions
- Check conn.isWrapperFor(iface) first and handle the false branch
- Unwrap the pool's proxy to java.sql.Connection before any driver-specific unwrap
- Only request interfaces PrestoConnection actually implements (Wrapper/Connection/AutoCloseable/PrestoConnection)
Example fix
// before
PrestoConnection pc = conn.unwrap(PrestoConnection.class); // throws if not Presto
// after
if (conn.isWrapperFor(PrestoConnection.class)) {
PrestoConnection pc = conn.unwrap(PrestoConnection.class);
} else {
// handle non-Presto connection
} Defensive patterns
Strategy: validation
Validate before calling
if (!connection.isWrapperFor(iface)) {
// not supported: handle before calling unwrap
}
Object unwrapped = connection.unwrap(iface); Type guard
static <T> Optional<T> safeUnwrap(Connection c, Class<T> iface) {
try {
return c.isWrapperFor(iface)
? Optional.of(iface.cast(c.unwrap(iface)))
: Optional.empty();
} catch (SQLException e) {
return Optional.empty();
}
} Prevention
- Always call isWrapperFor before unwrap
- Unwrap pool proxies to java.sql.Connection before driver-specific unwraps
- Restrict driver-specific casts to code paths that know the driver is Presto
When it happens
Trigger: conn.unwrap(SomeVendorInterface.class) on a PrestoConnection; unwrapping a pooled proxy to a driver-specific type that the proxy itself does not handle; requesting interfaces only other drivers implement (e.g. OracleConnection).
Common situations: Generic code that unwraps to native connections under HikariCP/DBCP; copy-pasted vendor-specific unwrap calls after switching drivers.
Related errors
- Expected column to be a time type but is
- Expected column to be a timestamp type but is
- NOT_SUPPORTED
- Invalid array block:
- Invalid map block:
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/4319b1be88782a48.
Report an issue: GitHub.