prestodb/presto · error · SchemaNotFoundException

NOT_FOUND

NOT_FOUND

Error message

Schema ${schemaName} not found

What it means

Thrown by NoSchemaEmulation.dropSchema when asked to drop any schema other than 'default'. This connector runs with schema emulation disabled, so only the implicit 'default' schema exists and it cannot be dropped. The error is wrapped in SchemaNotFoundException and surfaced as NOT_FOUND.

Source

Thrown at presto-kudu/src/main/java/com/facebook/presto/kudu/schema/NoSchemaEmulation.java:48

    @Override
    public void createSchema(KuduClient client, String schemaName)
    {
        if (DEFAULT_SCHEMA.equals(schemaName)) {
            throw new SchemaAlreadyExistsException(schemaName);
        }
        else {
            throw new PrestoException(GENERIC_USER_ERROR, "Creating schema in Kudu connector not allowed if schema emulation is disabled.");
        }
    }

    @Override
    public void dropSchema(KuduClient client, String schemaName)
    {
        if (DEFAULT_SCHEMA.equals(schemaName)) {
            throw new PrestoException(GENERIC_USER_ERROR, "Deleting default schema not allowed.");
        }
        else {
            throw new SchemaNotFoundException(schemaName);
        }
    }

    @Override
    public boolean existsSchema(KuduClient client, String schemaName)
    {
        return DEFAULT_SCHEMA.equals(schemaName);
    }

    @Override
    public List<String> listSchemaNames(KuduClient client)
    {
        return ImmutableList.of("default");
    }

    @Override
    public String toRawName(SchemaTableName schemaTableName)
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Only reference the 'default' schema when schema emulation is disabled; drop tables instead of schemas
  2. Enable schema emulation in the catalog properties (kudu.schema-emulation.enabled=true) if you need named schemas
  3. Verify which catalog you are connected to; use a catalog that has schema emulation enabled for multi-schema workloads

Example fix

// before
DROP SCHEMA analytics;
// after
-- with kudu.schema-emulation.enabled=false, drop the tables instead
DROP TABLE analytics.events;
DROP TABLE analytics.users;
Defensive patterns

Strategy: validation

Validate before calling

if ("default".equals(schemaName)) {
    throw new IllegalArgumentException("Cannot drop the default schema");
}
// else proceed only if catalog has schema emulation enabled

Try / catch

try {
    metadata.dropSchema(...);
} catch (PrestoException e) {
    if (e.getErrorCode().getCode() == StandardErrorCode.NOT_FOUND.getCode()) {
        // schema does not exist under no-emulation mode
    }
}

Prevention

When it happens

Trigger: Calling the connector's dropSchema (e.g. DROP SCHEMA) with schemaName != 'default' on a Kudu connector configured with schema emulation disabled (kudu.schema-emulation.enabled=false).

Common situations: Running DROP SCHEMA my_schema against a Kudu catalog that was created without schema emulation enabled; scripts written for a schema-emulation-enabled catalog reused on a default-schema-only catalog; migrating table layouts between catalogs.

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/5238bea94a6efdd3. Report an issue: GitHub.