{"record":{"id":"b8a0a4953bf25595","repo":"prestodb/presto","slug":"missing-schema-b8a0a4","errorCode":"MISSING_SCHEMA","errorMessage":"Schema '%s' does not exist","messagePattern":"Schema '(.+?)' does not exist","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/metadata/MetadataManager.java","lineNumber":410,"sourceCode":"        ImmutableSet.Builder<String> schemaNames = ImmutableSet.builder();\n        if (catalog.isPresent()) {\n            CatalogMetadata catalogMetadata = catalog.get();\n            ConnectorSession connectorSession = session.toConnectorSession(catalogMetadata.getConnectorId());\n            for (ConnectorId connectorId : catalogMetadata.listConnectorIds()) {\n                ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId);\n                metadata.listSchemaNames(connectorSession).stream()\n                        .map(schema -> normalizeIdentifier(session, connectorId.getCatalogName(), schema))\n                        .forEach(schemaNames::add);\n            }\n        }\n        return ImmutableList.copyOf(schemaNames.build());\n    }\n\n    @Override\n    public Map<String, Object> getSchemaProperties(Session session, CatalogSchemaName schemaName)\n    {\n        if (!getMetadataResolver(session).schemaExists(schemaName)) {\n            throw new SemanticException(MISSING_SCHEMA, format(\"Schema '%s' does not exist\", schemaName));\n        }\n\n        Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, transactionManager, schemaName.getCatalogName());\n        CatalogMetadata catalogMetadata = catalog.get();\n        ConnectorSession connectorSession = session.toConnectorSession(catalogMetadata.getConnectorId());\n        ConnectorMetadata metadata = catalogMetadata.getMetadataFor(catalogMetadata.getConnectorId());\n\n        return metadata.getSchemaProperties(connectorSession, schemaName);\n    }\n\n    @Override\n    public Optional<TableHandle> getTableHandleForStatisticsCollection(Session session, QualifiedObjectName table, Map<String, Object> analyzeProperties)\n    {\n        requireNonNull(table, \"table is null\");\n\n        Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, transactionManager, table.getCatalogName());\n        if (catalog.isPresent()) {\n            CatalogMetadata catalogMetadata = catalog.get();","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/metadata/MetadataManager.java#L392-L428","documentation":"MetadataManager.getSchemaProperties looks up the properties of a schema. Before resolving connector metadata it checks schemaExists; if the schema is absent in the target catalog it throws a SemanticException with MISSING_SCHEMA. This is the canonical 'schema does not exist' user error surfaced during DDL/SHOW operations on schema properties.","triggerScenarios":"Calling getSchemaProperties (or running statements that read schema properties) with a CatalogSchemaName whose schema does not exist in the given catalog — e.g. SHOW CREATE SCHEMA / ALTER SCHEMA ... on a misspelled or dropped schema.","commonSituations":"Typo in schema name; querying the wrong catalog (schema exists in another catalog); schema dropped concurrently by another job; case-sensitivity issues where the connector stores names differently.","solutions":["Verify the schema exists: SHOW SCHEMAS FROM <catalog> and check the exact name","Qualify the schema with the correct catalog name","Recreate the schema if it was dropped (CREATE SCHEMA)","Check case/identifier quoting if the connector is case-sensitive"],"exampleFix":"// before\nSHOW CREATE SCHEMA mycat.myshema; -- typo\n// after\nSHOW SCHEMAS FROM mycat; -- then use the correct name\nSHOW CREATE SCHEMA mycat.myschema;","handlingStrategy":"validation","validationCode":"if (!metadataManager.schemaExists(session, catalogSchemaName)) {\n    throw new IllegalArgumentException(\"Schema not found: \" + catalogSchemaName);\n}\n// or via SQL: SHOW SCHEMAS FROM <catalog> first","typeGuard":null,"tryCatchPattern":"try { props = metadata.getSchemaProperties(session, schemaName); }\ncatch (SemanticException e) { if (MISSING_SCHEMA == e.getCode()) { /* create schema or correct the name */ } else throw e; }","preventionTips":["List schemas with SHOW SCHEMAS FROM <catalog> before operating on one","Always qualify schema with its catalog name","Watch for concurrent DROP SCHEMA jobs in shared environments","Mind identifier case sensitivity per connector"],"tags":["presto","schema","metadata","sql"],"backgroundTag":"schema-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"}