{"record":{"id":"fd1c60064bf30be2","repo":"prestodb/presto","slug":"missing-table-fd1c60","errorCode":"MISSING_TABLE","errorMessage":"Table %s does not exist","messagePattern":"Table (.+?) does not exist","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/util/MetadataUtils.java","lineNumber":92,"sourceCode":"        return session.getRuntimeStats().recordWallTime(\n                GET_MATERIALIZED_VIEW_TIME_NANOS,\n                () -> metadataResolver.getMaterializedView(viewName));\n    }\n\n    public static TableColumnMetadata getTableColumnMetadata(Session session, MetadataResolver metadataResolver, QualifiedObjectName tableName)\n    {\n        Optional<TableHandle> tableHandle = session.getRuntimeStats().recordWallTime(\n                GET_TABLE_HANDLE_TIME_NANOS,\n                () -> metadataResolver.getTableHandle(tableName));\n\n        if (!tableHandle.isPresent()) {\n            if (!metadataResolver.catalogExists(tableName.getCatalogName())) {\n                throw new SemanticException(MISSING_CATALOG, \"Catalog %s does not exist\", tableName.getCatalogName());\n            }\n            if (!metadataResolver.schemaExists(new CatalogSchemaName(tableName.getCatalogName(), tableName.getSchemaName()))) {\n                throw new SemanticException(MISSING_SCHEMA, \"Schema %s does not exist\", tableName.getSchemaName());\n            }\n            throw new SemanticException(MISSING_TABLE, \"Table %s does not exist\", tableName);\n        }\n\n        Map<String, ColumnHandle> columnHandles = session.getRuntimeStats().recordWallTime(\n                GET_COLUMN_HANDLE_TIME_NANOS,\n                () -> metadataResolver.getColumnHandles(tableHandle.get()));\n\n        List<ColumnMetadata> columnsMetadata = session.getRuntimeStats().recordWallTime(\n                GET_COLUMN_METADATA_TIME_NANOS,\n                () -> metadataResolver.getColumns(tableHandle.get()));\n\n        return new TableColumnMetadata(tableHandle, columnHandles, columnsMetadata);\n    }\n}\n","sourceCodeStart":74,"sourceCodeEnd":106,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/util/MetadataUtils.java#L74-L106","documentation":"Final fallback in MetadataUtils.getTableColumnMetadata: when catalog and schema both exist but the resolver still returns no TableHandle, it throws SemanticException MISSING_TABLE naming the full table. The connector can see the namespace but no table with that name.","triggerScenarios":"SELECT/DESCRIBE/SHOW COLUMNS on catalog.schema.table where the table name is wrong or the table was dropped; permission-filtered visibility making the table appear nonexistent; a connector that lazily lists metadata not seeing the table.","commonSituations":"Typo in table name; table dropped or renamed by another job; stale assumptions after redeployments; connector metastore lag (e.g. Hive metastore eventual issues); insufficient privileges masking the table.","solutions":["Run SHOW TABLES FROM <catalog>.<schema> to confirm the exact table name","Create the table if missing (CREATE TABLE ... AS ...) or fix the name","Check privileges/visibility rules if the table should exist","Verify the underlying metastore/connector actually contains the table"],"exampleFix":"// before\nSELECT * FROM postgresql.public.ordre; -- typo\n// after\nSELECT * FROM postgresql.public.orders;","handlingStrategy":"try-catch","validationCode":"// Check table existence before fetching column metadata\nif (!metadata.listTables(session, schemaName).stream()\n        .anyMatch(t -> t.getTableName().equalsIgnoreCase(tableName))) {\n    throw new IllegalArgumentException(\"Unknown table: \" + tableName);\n}","typeGuard":null,"tryCatchPattern":"try {\n    columns = MetadataUtils.getTableColumnMetadata(...);\n} catch (SemanticException e) {\n    if (e.getCode() == MISSING_TABLE) {\n        throw new UserError(\"Table not found: \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Run SHOW TABLES FROM <catalog>.<schema> to confirm names","Handle table drops/renames with migration-aware retries (once)","Check connector privileges if tables seem to disappear","Track DDL changes that could invalidate referenced table names"],"tags":["table","metadata","missing","semantic"],"backgroundTag":"table-not-found","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}