prestodb/presto · error · PrestoException

ALREADY_EXISTS

ALREADY_EXISTS

Error message

Schema [%s] already exists

What it means

Generic guard in BlackHoleMetadata.createSchema: the blackhole connector keeps schemas only in an in-memory list, and this fires when CREATE SCHEMA is issued for a schema name already in that list — a duplicate schema creation by the user.

Source

Thrown at presto-blackhole/src/main/java/com/facebook/presto/plugin/blackhole/BlackHoleMetadata.java:87

    private final List<String> schemas = new ArrayList<>();
    private final Map<SchemaTableName, BlackHoleTableHandle> tables = new ConcurrentHashMap<>();

    public BlackHoleMetadata()
    {
        schemas.add(SCHEMA_NAME);
    }

    @Override
    public List<String> listSchemaNames(ConnectorSession session)
    {
        return ImmutableList.copyOf(schemas);
    }

    @Override
    public synchronized void createSchema(ConnectorSession session, String schemaName, Map<String, Object> properties)
    {
        if (schemas.contains(schemaName)) {
            throw new PrestoException(ALREADY_EXISTS, format("Schema [%s] already exists", schemaName));
        }
        schemas.add(schemaName);
    }

    @Override
    public ConnectorTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
    {
        return tables.get(tableName);
    }

    @Override
    public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle tableHandle)
    {
        BlackHoleTableHandle blackHoleTableHandle = (BlackHoleTableHandle) tableHandle;
        return toTableMetadata(blackHoleTableHandle, session);
    }

    public ConnectorTableMetadata toTableMetadata(BlackHoleTableHandle blackHoleTableHandle, ConnectorSession session)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use a schema name that does not already exist
  2. Drop or restart the BlackHole catalog to reset the in-memory schema list
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-blackhole/src/main/java/com/facebook/presto/plugin/blackhole/BlackHoleMetadata.java:87 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/b761aa1a746c22af. Report an issue: GitHub.