prestodb/presto · error · PrestoException

SCHEMA_NOT_READABLE

SCHEMA_NOT_READABLE

Error message

Spreadsheet %s not readable

What it means

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.

Source

Thrown at presto-lark-sheets/src/main/java/com/facebook/presto/lark/sheets/LarkSheetsMetadata.java:273

    private LarkSheetsSchema requireVisibleSchema(ConnectorSession session, String schemaName)
    {
        return getVisibleSchema(session, schemaName)
                .orElseThrow(() -> new PrestoException(SCHEMA_NOT_EXISTS,
                        format("Schema %s not exists or not visible", schemaName)));
    }

    private void checkSchemaUpdatable(LarkSheetsSchema schema, String operationUser, String operation)
    {
        if (!schema.getUser().equalsIgnoreCase(operationUser)) {
            throw new PrestoException(NOT_PERMITTED,
                    format("User '%s' is not permitted to perform '%s' on schema '%s'", operationUser, operation, schema.getName()));
        }
    }

    private void checkSchemaReadable(LarkSheetsSchema schema)
    {
        if (!api.isReadable(schema.getToken())) {
            throw new PrestoException(SCHEMA_NOT_READABLE,
                    format("Spreadsheet %s not readable", schema.getToken()));
        }
    }

    private List<LarkSheetsColumnHandle> getColumns(LarkSheetsTableHandle table)
    {
        List<String> header = api.getHeaderRow(table.getSpreadsheetToken(), table.getSheetId(), table.getColumnCount());

        int numColumns = header.size();
        LinkedHashMap<String, LarkSheetsColumnHandle> columns = new LinkedHashMap<>(numColumns);
        for (int i = 0; i < numColumns; i++) {
            String rawColumnName = header.get(i);
            if (rawColumnName == null) {
                // Columns without name are ignored
                continue;
            }
            String columnName = rawColumnName.toLowerCase(ENGLISH);
            LarkSheetsColumnHandle column = columns.get(columnName);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Share the spreadsheet with the Lark app's identity or grant it read permission on the document.
  2. Verify the schema's spreadsheet token is correct and the document still exists (not trashed).
  3. Re-create the schema pointing at a valid, accessible spreadsheet.
  4. Check the app credential (app id/secret) is valid and has document-scope permissions in Lark admin console.

Example fix

// before: schema token points to a doc the app cannot read
CREATE SCHEMA lark_sheets.team_data WITH (token = 'bascnXXXXXXXX');
// after: in Lark UI, share doc bascnXXXXXXXX with the app / service account, keep token unchanged
Defensive patterns

Strategy: validation

Validate before calling

// pre-check with Lark API before querying
boolean readable = larkApi.isReadable(schemaToken);
if (!readable) throw new IllegalStateException("Grant the app read access to doc " + schemaToken);

Try / catch

try { metadata.getTableHandle(session, name); } catch (PrestoException e) { if (e.getErrorCode().equals(SCHEMA_NOT_READABLE.toErrorCode())) { // fix doc permissions, then retry } else { throw e; } }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/23697f45f4b11589. Report an issue: GitHub.