{"record":{"id":"5ab9f4e19ef0b3b1","repo":"prestodb/presto","slug":"catalog-not-specified","errorCode":"CATALOG_NOT_SPECIFIED","errorMessage":"Catalog must be specified when session catalog is not set","messagePattern":"Catalog must be specified when session catalog is not set","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/UseTask.java","lineNumber":74,"sourceCode":"            QueryStateMachine stateMachine,\n            List<Expression> parameters,\n            String query)\n    {\n        Session session = stateMachine.getSession();\n\n        checkCatalogAndSessionPresent(statement, session);\n\n        checkAndSetCatalog(statement, metadata, stateMachine, session, accessControl);\n\n        checkAndSetSchema(statement, metadata, stateMachine, session, accessControl);\n\n        return immediateFuture(null);\n    }\n\n    private void checkCatalogAndSessionPresent(Use statement, Session session)\n    {\n        if (!statement.getCatalog().isPresent() && !session.getCatalog().isPresent()) {\n            throw new SemanticException(CATALOG_NOT_SPECIFIED, statement, \"Catalog must be specified when session catalog is not set\");\n        }\n    }\n\n    private void checkAndSetCatalog(Use statement, Metadata metadata, QueryStateMachine stateMachine, Session session, AccessControl accessControl)\n    {\n        String catalog = statement.getCatalog()\n                .map(Identifier::getValueLowerCase)\n                .orElseGet(() -> session.getCatalog().map(String::toLowerCase).get());\n        getConnectorIdOrThrow(session, metadata, catalog);\n        if (!hasCatalogAccess(session.getIdentity(), session.getAccessControlContext(), catalog, accessControl)) {\n            denyCatalogAccess(catalog);\n        }\n        stateMachine.setSetCatalog(catalog);\n    }\n\n    private void checkAndSetSchema(Use statement, Metadata metadata, QueryStateMachine stateMachine, Session session, AccessControl accessControl)\n    {\n        String catalog = statement.getCatalog()","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/UseTask.java#L56-L92","documentation":"Validation in checkCatalogAndSessionPresent for the USE statement: the statement names only a schema (USE schema) and the session has no current catalog set, so there is no catalog in which to resolve the schema.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/UseTask.java:74 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wrap the USE statement execution site so that when neither the statement nor the session specifies a catalog, the error is surfaced with a corrected statement like USE catalog.schema instead of catalog-only or schema-only syntax","Configure a default session catalog (e.g. via the client's session properties or --catalog flag) so checkCatalogAndSessionPresent always has a catalog available","In tooling that builds USE statements programmatically, validate that a catalog is present before dispatching, or fall back to a fully qualified catalog.schema pair derived from the connection configuration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}