{"record":{"id":"a350a31323528ee9","repo":"prestodb/presto","slug":"missing-catalog-a350a3","errorCode":"MISSING_CATALOG","errorMessage":"Catalog '${catalogName}' does not exist","messagePattern":"Catalog '(.+?)' does not exist","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java","lineNumber":240,"sourceCode":"        {\n            Statement statement = (Statement) process(node.getStatement(), null);\n            return new Explain(\n                    node.getLocation().get(),\n                    node.isAnalyze(),\n                    node.isVerbose(),\n                    statement,\n                    node.getOptions());\n        }\n\n        @Override\n        protected Node visitShowTables(ShowTables showTables, Void context)\n        {\n            CatalogSchemaName schema = createCatalogSchemaName(session, showTables, showTables.getSchema(), metadata);\n\n            accessControl.checkCanShowTablesMetadata(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), schema);\n\n            if (!metadataResolver.catalogExists(schema.getCatalogName())) {\n                throw new SemanticException(MISSING_CATALOG, showTables, \"Catalog '%s' does not exist\", schema.getCatalogName());\n            }\n\n            if (!metadataResolver.schemaExists(schema)) {\n                throw new SemanticException(MISSING_SCHEMA, showTables, \"Schema '%s' does not exist\", schema.getSchemaName());\n            }\n\n            Expression predicate = equal(identifier(\"table_schema\"), new StringLiteral(schema.getSchemaName()));\n\n            Optional<String> likePattern = showTables.getLikePattern();\n            if (likePattern.isPresent()) {\n                Expression likePredicate = new LikePredicate(\n                        identifier(\"table_name\"),\n                        new StringLiteral(likePattern.get()),\n                        showTables.getEscape().map(StringLiteral::new));\n                predicate = logicalAnd(predicate, likePredicate);\n            }\n\n            return simpleQuery(","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java#L222-L258","documentation":"SHOW TABLES first resolves the target catalog via createCatalogSchemaName (which falls back to the session catalog). If neither the statement nor the session specifies a catalog that exists, metadataResolver.catalogExists fails and a SemanticException MISSING_CATALOG is thrown for the SHOW TABLES statement.","triggerScenarios":"Running `SHOW TABLES FROM schema` (or `SHOW TABLES`) while the session's catalog is unset or names a nonexistent catalog, so schema.getCatalogName() does not exist in the metadata resolver.","commonSituations":"Connecting without setting a default catalog; typo in catalog name in `SHOW TABLES FROM cat.schema`; catalog removed/unloaded after a connector config change.","solutions":["Fully qualify the schema: `SHOW TABLES FROM <catalog>.<schema>`, with the catalog spelled correctly.","Set the session catalog first: `USE <catalog>.<schema>` then run SHOW TABLES.","Verify the catalog exists (check etc/catalog/*.properties and that the connector loaded).","Reconnect choosing a default catalog in the client if the tool supports it."],"exampleFix":"// before\nSHOW TABLES FROM myschema            -- no session catalog\n// after\nSHOW TABLES FROM hive.myschema","handlingStrategy":"validation","validationCode":"// Confirm the catalog exists before SHOW TABLES\nboolean exists = client.execute(\"SELECT 1 FROM system.metadata.catalogs WHERE catalog_name = '\" + catalog + \"'\").hasRows();\nif (!exists) throw new IllegalArgumentException(\"Catalog not found: \" + catalog);","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(\"SHOW TABLES FROM \" + schema);\n} catch (SemanticException e) {\n    if (e.getCode() == SemanticErrorCode.MISSING_CATALOG) {\n        // prompt for catalog or list: SHOW CATALOGS\n    } else throw e;\n}","preventionTips":["Always qualify SHOW TABLES with catalog.schema","Run SHOW CATALOGS to verify the catalog name","Set a default catalog on connection","Check connector config files (etc/catalog/*.properties) are deployed in the target environment"],"tags":["sql","show-tables","catalog","semantic-error"],"backgroundTag":"catalog-does-not-exist","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"}