{"record":{"id":"eb1da92e351b7c99","repo":"prestodb/presto","slug":"not-permitted","errorCode":"NOT_PERMITTED","errorMessage":"Schema is required to list tables","messagePattern":"Schema is required to list tables","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-lark-sheets/src/main/java/com/facebook/presto/lark/sheets/LarkSheetsMetadata.java","lineNumber":168,"sourceCode":"        LarkSheetsTableHandle sheetsTable = (LarkSheetsTableHandle) table;\n        List<LarkSheetsColumnHandle> sheetsColumns = getColumns(sheetsTable);\n        List<ColumnMetadata> columnMetadatas = toColumnMetadatas(session, sheetsColumns);\n        return new ConnectorTableMetadata(sheetsTable.getSchemaTableName(), columnMetadatas);\n    }\n\n    @Override\n    public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle)\n    {\n        LarkSheetsTableHandle sheetsTable = (LarkSheetsTableHandle) tableHandle;\n        List<LarkSheetsColumnHandle> columns = getColumns(sheetsTable);\n        return columns.stream().collect(toImmutableMap(LarkSheetsColumnHandle::getName, Function.identity()));\n    }\n\n    @Override\n    public List<SchemaTableName> listTables(ConnectorSession session, Optional<String> schemaName)\n    {\n        if (!schemaName.isPresent()) {\n            throw new PrestoException(NOT_PERMITTED, \"Schema is required to list tables\");\n        }\n        LarkSheetsSchema schema = requireVisibleSchema(session, schemaName.get());\n        checkSchemaReadable(schema);\n        return api.getMetaInfo(schema.getToken())\n                .getSheets()\n                .stream()\n                .sorted(SheetInfo.indexComparator())\n                .map(sheet -> new SchemaTableName(schema.getName(), sheet.getTitle()))\n                .collect(toImmutableList());\n    }\n\n    @Override\n    public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle)\n    {\n        return ((LarkSheetsColumnHandle) columnHandle).toColumnMetadata();\n    }\n\n    @Override","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-lark-sheets/src/main/java/com/facebook/presto/lark/sheets/LarkSheetsMetadata.java#L150-L186","documentation":"LarkSheetsMetadata.listTables requires a concrete schema because listing tables means enumerating sheets of a specific Lark spreadsheet (schema = spreadsheet token). When listTables is called with an empty Optional<String> schemaName (e.g. SHOW TABLES without a schema, or connector-wide table listing), there is no spreadsheet to inspect, so the connector throws StandardErrorCode.NOT_PERMITTED with 'Schema is required to list tables'.","triggerScenarios":"SHOW TABLES executed while not bound to a specific Lark Sheets schema; a tool or framework calling listTables(session, Optional.empty()); catalog-wide metadata scans that ask for all tables across all schemas.","commonSituations":"Running SHOW TABLES without USE-ing a schema; BI tools that enumerate every table in the catalog at import time; migration/validation scripts iterating the whole catalog.","solutions":["Qualify the listing: run SHOW TABLES FROM <schema> (the schema being the Lark Sheets schema/spreadsheet name).","USE <catalog>.<schema> first, then SHOW TABLES.","In code, pass Optional.of(schemaName) instead of Optional.empty() to listTables.","Configure the connector to limit catalog-wide scans if your tooling cannot scope to a schema."],"exampleFix":"-- before\nSHOW TABLES;\n-- after\nUSE lark_sheets.my_spreadsheet_schema;\nSHOW TABLES;","handlingStrategy":"validation","validationCode":"if (schemaName == null || schemaName.isEmpty()) {\n    throw new IllegalArgumentException(\"Pass a schema: SHOW TABLES FROM lark_sheets.<schema>\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always USE <catalog>.<schema> before SHOW TABLES","Qualify table listings with the schema name in BI tool configs","Never call listTables with Optional.empty() in code","Scope catalog scanners to explicit schemas for Lark Sheets"],"tags":["presto-connector","lark-sheets","metadata","schema-required"],"backgroundTag":"schema-required","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"}