{"record":{"id":"23697f45f4b11589","repo":"prestodb/presto","slug":"schema-not-readable","errorCode":"SCHEMA_NOT_READABLE","errorMessage":"Spreadsheet %s not readable","messagePattern":"Spreadsheet (.+?) not readable","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-lark-sheets/src/main/java/com/facebook/presto/lark/sheets/LarkSheetsMetadata.java","lineNumber":273,"sourceCode":"    private LarkSheetsSchema requireVisibleSchema(ConnectorSession session, String schemaName)\n    {\n        return getVisibleSchema(session, schemaName)\n                .orElseThrow(() -> new PrestoException(SCHEMA_NOT_EXISTS,\n                        format(\"Schema %s not exists or not visible\", schemaName)));\n    }\n\n    private void checkSchemaUpdatable(LarkSheetsSchema schema, String operationUser, String operation)\n    {\n        if (!schema.getUser().equalsIgnoreCase(operationUser)) {\n            throw new PrestoException(NOT_PERMITTED,\n                    format(\"User '%s' is not permitted to perform '%s' on schema '%s'\", operationUser, operation, schema.getName()));\n        }\n    }\n\n    private void checkSchemaReadable(LarkSheetsSchema schema)\n    {\n        if (!api.isReadable(schema.getToken())) {\n            throw new PrestoException(SCHEMA_NOT_READABLE,\n                    format(\"Spreadsheet %s not readable\", schema.getToken()));\n        }\n    }\n\n    private List<LarkSheetsColumnHandle> getColumns(LarkSheetsTableHandle table)\n    {\n        List<String> header = api.getHeaderRow(table.getSpreadsheetToken(), table.getSheetId(), table.getColumnCount());\n\n        int numColumns = header.size();\n        LinkedHashMap<String, LarkSheetsColumnHandle> columns = new LinkedHashMap<>(numColumns);\n        for (int i = 0; i < numColumns; i++) {\n            String rawColumnName = header.get(i);\n            if (rawColumnName == null) {\n                // Columns without name are ignored\n                continue;\n            }\n            String columnName = rawColumnName.toLowerCase(ENGLISH);\n            LarkSheetsColumnHandle column = columns.get(columnName);","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-lark-sheets/src/main/java/com/facebook/presto/lark/sheets/LarkSheetsMetadata.java#L255-L291","documentation":"checkSchemaReadable calls the Lark API isReadable(token) to verify the connector can actually read the spreadsheet backing the schema. If the API says it is not readable, it throws SCHEMA_NOT_READABLE with the (unmasked) spreadsheet token. Called before getTableHandle, getSystemTable, and listTables proceed.","triggerScenarios":"Any metadata/read path (SHOW TABLES, DESCRIBE, SELECT resolution) where api.isReadable(schema.getToken()) returns false — e.g. the app credential lacks read permission on the document, the doc was deleted, or the token is invalid.","commonSituations":"The spreadsheet was deleted or moved to trash; the Lark app was never granted access to the doc; doc permissions were revoked; wrong/expired document token configured for the schema.","solutions":["Share the spreadsheet with the Lark app's identity or grant it read permission on the document.","Verify the schema's spreadsheet token is correct and the document still exists (not trashed).","Re-create the schema pointing at a valid, accessible spreadsheet.","Check the app credential (app id/secret) is valid and has document-scope permissions in Lark admin console."],"exampleFix":"// before: schema token points to a doc the app cannot read\nCREATE SCHEMA lark_sheets.team_data WITH (token = 'bascnXXXXXXXX');\n// after: in Lark UI, share doc bascnXXXXXXXX with the app / service account, keep token unchanged","handlingStrategy":"validation","validationCode":"// pre-check with Lark API before querying\nboolean readable = larkApi.isReadable(schemaToken);\nif (!readable) throw new IllegalStateException(\"Grant the app read access to doc \" + schemaToken);","typeGuard":null,"tryCatchPattern":"try { metadata.getTableHandle(session, name); } catch (PrestoException e) { if (e.getErrorCode().equals(SCHEMA_NOT_READABLE.toErrorCode())) { // fix doc permissions, then retry } else { throw e; } }","preventionTips":["Share every referenced spreadsheet with the Lark app identity","Verify tokens point to live, non-trashed documents","Keep app credentials and document scopes valid in Lark admin","Re-check permissions after doc moves or app re-registration"],"tags":["presto-connector","lark-sheets","authorization","permissions"],"backgroundTag":"permission-denied","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"}