prestodb/presto · error · SemanticException
MISSING_SCHEMA
MISSING_SCHEMA
Error message
Schema does not exist: %s.%s
What it means
UseTask validation while executing a USE catalog.schema statement: after confirming the catalog exists and is accessible, the metadata lookup found no schema with the given name in that catalog. The catalog and schema names are formatted into the message so the mistyped component is identifiable.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/UseTask.java:99
.map(Identifier::getValueLowerCase)
.orElseGet(() -> session.getCatalog().map(String::toLowerCase).get());
getConnectorIdOrThrow(session, metadata, catalog);
if (!hasCatalogAccess(session.getIdentity(), session.getAccessControlContext(), catalog, accessControl)) {
denyCatalogAccess(catalog);
}
stateMachine.setSetCatalog(catalog);
}
private void checkAndSetSchema(Use statement, Metadata metadata, QueryStateMachine stateMachine, Session session, AccessControl accessControl)
{
String catalog = statement.getCatalog()
.map(Identifier::getValueLowerCase)
.orElseGet(() -> session.getCatalog().map(String::toLowerCase).get());
Identifier schemaIdentifier = statement.getSchema();
String schema = metadata.normalizeIdentifier(session, catalog, schemaIdentifier.getValue());
if (!metadata.getMetadataResolver(session).schemaExists(new CatalogSchemaName(catalog, schema))) {
throw new SemanticException(MISSING_SCHEMA, format("Schema does not exist: %s.%s", catalog, schema));
}
if (!hasSchemaAccess(session.getTransactionId().get(), session.getIdentity(), session.getAccessControlContext(), catalog, schema, accessControl)) {
throw new AccessDeniedException("Cannot access schema: " + new CatalogSchemaName(catalog, schema));
}
stateMachine.setSetSchema(schema);
}
private boolean hasCatalogAccess(Identity identity, AccessControlContext context, String catalog, AccessControl accessControl)
{
return !accessControl.filterCatalogs(identity, context, ImmutableSet.of(catalog)).isEmpty();
}
private boolean hasSchemaAccess(TransactionId transactionId, Identity identity, AccessControlContext context, String catalog, String schema, AccessControl accessControl)
{
return !accessControl.filterSchemas(transactionId, identity, context, catalog, ImmutableSet.of(schema)).isEmpty();
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- List available schemas with SHOW SCHEMAS FROM catalog and correct the name
- Create the schema with CREATE SCHEMA if it is expected to exist
- Check for typos in the schema identifier
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/UseTask.java:99 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/8409acf3a56185a0.
Report an issue: GitHub.