prestodb/presto · error · SchemaNotFoundException

NOT_FOUND

NOT_FOUND

Error message

Schema ${schemaName} not found

What it means

Thrown by SchemaEmulationByTableNameConvention.toRawName when the schema name contains a dot or is otherwise not resolvable under table-name-convention emulation. Dotted schema names cannot be encoded into raw table names, so the schema is reported as not found (NOT_FOUND).

Source

Thrown at presto-kudu/src/main/java/com/facebook/presto/kudu/schema/SchemaEmulationByTableNameConvention.java:218

    public String toRawName(SchemaTableName schemaTableName)
    {
        if (DEFAULT_SCHEMA.equals(schemaTableName.getSchemaName())) {
            if (commonPrefix.isEmpty()) {
                if (schemaTableName.getTableName().indexOf('.') != -1) {
                    // in default schema table name must not contain dots if common prefix is empty
                    throw new PrestoException(GENERIC_USER_ERROR, "Table name conflicts with schema emulation settings. No '.' allowed for tables in schema 'default'.");
                }
            }
            else {
                if (schemaTableName.getTableName().startsWith(commonPrefix)) {
                    // in default schema table name must not start with common prefix
                    throw new PrestoException(GENERIC_USER_ERROR, "Table name conflicts with schema emulation settings. Table name must not start with '" + commonPrefix + "'.");
                }
            }
        }
        else if (schemaTableName.getSchemaName().indexOf('.') != -1) {
            // schema names with dots are not possible
            throw new SchemaNotFoundException(schemaTableName.getSchemaName());
        }

        if (DEFAULT_SCHEMA.equals(schemaTableName.getSchemaName())) {
            return schemaTableName.getTableName();
        }
        else {
            return commonPrefix + schemaTableName.getSchemaName() + "." + schemaTableName.getTableName();
        }
    }

    @Override
    public SchemaTableName fromRawName(String rawName)
    {
        if (commonPrefix.isEmpty()) {
            int dotIndex = rawName.indexOf('.');
            if (dotIndex == -1) {
                return new SchemaTableName(DEFAULT_SCHEMA, rawName);
            }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use a dot-free schema name (CREATE SCHEMA a_b instead of a.b)
  2. Reference tables only in the 'default' schema or valid emulated schemas
  3. Enable a different schema emulation mode / connector with nested namespace support if dotted names are required

Example fix

// before
SELECT * FROM kudu.analytics.web.events;
// after
SELECT * FROM kudu.analytics_web.events;
Defensive patterns

Strategy: validation

Validate before calling

if (schemaName.indexOf('.') != -1) {
    throw new IllegalArgumentException("Schema names must not contain '.'");
}

Try / catch

try {
    table = metadata.getTableHandle(session, schemaTableName);
} catch (PrestoException e) {
    if (e.getErrorCode().getCode() == StandardErrorCode.NOT_FOUND.getCode()) {
        // surface friendly 'schema not supported' message
    }
}

Prevention

When it happens

Trigger: Referencing a schema whose name contains '.' (e.g. a.b.my_table) on a Kudu catalog using table-name-convention emulation; also any non-default schema name that fails resolution.

Common situations: Queries ported from Hive-style catalogs with nested namespaces; tools splitting qualified names on dots; typos producing schema names containing dots.

Understand the failure class

Background: NOT_FOUND error code: why tRPC, Harbor, Nacos and other libraries return 404 "not found" errors for resources that may still exist — this error's family across 11 libraries.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/3b80267194a120ac. Report an issue: GitHub.