{"record":{"id":"cc6f16239aad7bb3","repo":"prestodb/presto","slug":"missing-catalog-cc6f16","errorCode":"MISSING_CATALOG","errorMessage":"Catalog '%s' 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/execution/CreateViewTask.java","lineNumber":97,"sourceCode":"    public String getName()\n    {\n        return \"CREATE VIEW\";\n    }\n\n    @Override\n    public String explain(CreateView statement, List<Expression> parameters)\n    {\n        return \"CREATE VIEW \" + statement.getName();\n    }\n\n    @Override\n    public ListenableFuture<?> execute(CreateView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName(), metadata);\n        MetadataResolver metadataResolver = metadata.getMetadataResolver(session);\n\n        if (!metadataResolver.catalogExists(name.getCatalogName())) {\n            throw new SemanticException(MISSING_CATALOG, \"Catalog '%s' does not exist\", name.getCatalogName());\n        }\n\n        if (!metadataResolver.schemaExists(name.getCatalogSchemaName())) {\n            throw new SemanticException(MISSING_SCHEMA, statement, \"Schema '%s' does not exist\", name.getSchemaName());\n        }\n\n        accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), name);\n\n        String sql = getFormattedSql(statement.getQuery(), sqlParser, Optional.of(parameters));\n\n        Analysis analysis = analyzeStatement(statement, session, metadata, accessControl, parameters, warningCollector, query);\n\n        List<ViewColumn> columns = analysis.getOutputDescriptor(statement.getQuery())\n                .getVisibleFields().stream()\n                .map(field -> new ViewColumn(field.getName().get(), field.getType()))\n                .collect(toImmutableList());\n\n        List<ColumnMetadata> columnMetadata = columns.stream()","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/CreateViewTask.java#L79-L115","documentation":"CreateViewTask.execute resolves the target view name to a QualifiedObjectName and verifies the catalog exists via metadataResolver.catalogExists. If the catalog portion of the qualified name does not exist, it throws SemanticException(MISSING_CATALOG). This is a fail-fast check before schema or permission checks.","triggerScenarios":"Executing CREATE VIEW <catalog>.<schema>.<name> where <catalog> is not a registered/configured catalog in the Presto cluster.","commonSituations":"Typo in catalog name; connecting to a cluster that lacks a catalog configured on the coordinator; copying SQL from an environment with different catalogs; catalog removed from etc/catalog after a restart.","solutions":["Run SHOW CATALOGS and use an existing catalog name in the CREATE VIEW statement.","Check the coordinator's etc/catalog/ directory to confirm the intended catalog is configured, and restart/redeploy if it is missing.","Fix the typo in the qualified name (e.g. hive.web.page_views instead of hve.web.page_views)."],"exampleFix":"// before\nCREATE VIEW prod1.analytics.daily AS SELECT ...;\n// after (catalog 'prod1' does not exist; actual catalog is 'prod')\nCREATE VIEW prod.analytics.daily AS SELECT ...;","handlingStrategy":"validation","validationCode":"-- Validate catalog before CREATE VIEW\nSHOW CATALOGS LIKE 'prod';\n-- programmatic: query system.metadata.catalogs\nSELECT catalog_name FROM system.metadata.catalogs WHERE catalog_name = 'prod';","typeGuard":"function catalogExists(session, name) {\n  return session.execute('SELECT count(*) FROM system.metadata.catalogs WHERE catalog_name = ?', [name.catalog]) > 0;\n}","tryCatchPattern":"try {\n  session.execute(createViewSql);\n} catch (e) {\n  if (e.message.includes(\"does not exist\") && e.message.startsWith(\"Catalog\")) {\n    // surface list of available catalogs: SHOW CATALOGS\n  }\n  throw e;\n}","preventionTips":["Run SHOW CATALOGS to discover valid catalog names before writing DDL.","Keep catalog names centralized in config, never hardcoded strings.","Verify the target cluster's etc/catalog configuration after deployments."],"tags":["presto","sql","catalog","missing-resource"],"backgroundTag":"catalog-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"}