prestodb/presto · error · SemanticException

MISSING_TABLE

MISSING_TABLE

Error message

Source table '%s' does not exist

What it means

CREATE VECTOR INDEX requires the source table named in the statement to exist in the referenced catalog/schema. The analyzer resolves the qualified object name and checks the connector via metadataResolver.tableExists(); if the table is absent it raises MISSING_TABLE with the fully qualified name.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java:1267

        {
            analysis.setUpdateInfo(node.getUpdateInfo());
            return createAndAssignScope(node, scope);
        }

        @Override
        protected Scope visitCreateTable(CreateTable node, Optional<Scope> scope)
        {
            analysis.setUpdateInfo(node.getUpdateInfo());
            validateProperties(node.getProperties(), scope);
            return createAndAssignScope(node, scope);
        }

        @Override
        protected Scope visitCreateVectorIndex(CreateVectorIndex node, Optional<Scope> scope)
        {
            QualifiedObjectName sourceTableName = createQualifiedObjectName(session, node, node.getTableName(), metadata);
            if (!metadataResolver.tableExists(sourceTableName)) {
                throw new SemanticException(MISSING_TABLE, node, "Source table '%s' does not exist", sourceTableName);
            }

            QualifiedObjectName targetTable = createQualifiedObjectName(session, node, node.getIndexName(), metadata);

            // Analyze the source table to build a proper scope with typed columns
            // Use AllowAllAccessControl since we check permissions separately below
            StatementAnalyzer analyzer = new StatementAnalyzer(
                    analysis,
                    metadata,
                    sqlParser,
                    new AllowAllAccessControl(),
                    session,
                    warningCollector);

            Table sourceTable = new Table(node.getTableName());
            Scope tableScope = analyzer.analyze(sourceTable, scope);

            // Check for duplicate columns

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the table exists: SELECT * FROM system.jdbc.tables WHERE table_schem = '...' or run a DESCRIBE on it, and fix any typos.
  2. Check you are connected to the correct catalog/schema (USE catalog.schema).
  3. Confirm the table was not dropped/renamed and recreate it if needed.
  4. Verify connector/catalog configuration and permissions if the table visibly exists elsewhere.

Example fix

// before
CREATE VECTOR INDEX idx ON analytics.doc_embeedings(col);
// after
CREATE VECTOR INDEX idx ON analytics.doc_embeddings(col);
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = (boolean) query("SELECT count(*) > 0 FROM system.jdbc.tables " +
    "WHERE table_cat = ? AND table_schem = ? AND table_name = ?",
    catalog, schema, table).get(0).get(0);
if (!exists) throw new IllegalArgumentException("Source table missing: " + qualifiedName);

Try / catch

try {
    execute(createVectorIndexSql);
} catch (SemanticException e) {
    if (e.getCode() == MISSING_TABLE) {
        throw new IllegalStateException("Create/verify the source table before CREATE VECTOR INDEX", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: CREATE VECTOR INDEX ... ON catalog.schema.table ... where the connector reports the source table does not exist (typo, wrong catalog/schema, table dropped, or no permissions visible to the resolver).

Common situations: Typo in table or schema name; running the statement connected to the wrong catalog; case-sensitivity mismatches; the table was dropped or renamed before index creation; missing connector configuration so the catalog resolves but is empty.

Related errors


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