prestodb/presto · error · TableNotFoundException

NOT_FOUND

NOT_FOUND

Error message

Table '%s' not found

What it means

MongoDB connector error from getTableMetadata: no schema-metadata document with the given table name was found in the schema collection for the database. The %s names the missing table; raised while reading table metadata or column definitions for a table the connector does not know.

Source

Thrown at presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoSession.java:399

        return documentOf(NOT_EQ_OP, null);
    }

    // Internal Schema management
    private Document getTableMetadata(SchemaTableName schemaTableName)
            throws TableNotFoundException
    {
        String schemaName = schemaTableName.getSchemaName();
        String tableName = schemaTableName.getTableName();

        MongoDatabase db = client.getDatabase(schemaName);
        MongoCollection<Document> schema = db.getCollection(schemaCollection);

        Document doc = schema
                .find(new Document(TABLE_NAME_KEY, tableName)).first();

        if (doc == null) {
            if (!collectionExists(db, tableName)) {
                throw new TableNotFoundException(schemaTableName);
            }
            else {
                Document metadata = new Document(TABLE_NAME_KEY, tableName);
                metadata.append(FIELDS_KEY, guessTableFields(schemaTableName));
                metadata.append(TYPE_KEY, guessTableType(schemaName, tableName));

                schema.createIndex(new Document(TABLE_NAME_KEY, 1), new IndexOptions().unique(true));
                schema.insertOne(metadata);

                return metadata;
            }
        }

        return doc;
    }

    public boolean collectionExists(MongoDatabase db, String collectionName)
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the table exists and is registered in the schema collection (use the mongodb sync tool / CREATE TABLE)
  2. Check schema and table name spelling and case
  3. Re-create the table definition in Presto pointing at the collection
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoSession.java:399 when the library encounters an invalid state.

Common situations: See trigger scenarios.

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.


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