prestodb/presto · error · PrestoException

SHEETS_TABLE_LOAD_ERROR

SHEETS_TABLE_LOAD_ERROR

Error message

Error loading data for table: 

What it means

SheetsClient.readAllValues wraps any non-Presto failure from the sheet-data cache (UncheckedExecutionException whose cause is not a PrestoException) as SHEETS_TABLE_LOAD_ERROR. It means the table name was known, but actually fetching/reading the sheet data from the Google Sheets API failed.

Source

Thrown at presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsClient.java:157

        }
        catch (UncheckedExecutionException e) {
            throwIfInstanceOf(e.getCause(), PrestoException.class);
            throw new PrestoException(SHEETS_METASTORE_ERROR, e);
        }
    }

    public List<List<Object>> readAllValues(String tableName)
    {
        try {
            Optional<String> sheetExpression = tableSheetMappingCache.getUnchecked(tableName);
            if (!sheetExpression.isPresent()) {
                throw new PrestoException(SHEETS_UNKNOWN_TABLE_ERROR, "Sheet expression not found for table " + tableName);
            }
            return sheetDataCache.getUnchecked(sheetExpression.get());
        }
        catch (UncheckedExecutionException e) {
            throwIfInstanceOf(e.getCause(), PrestoException.class);
            throw new PrestoException(SHEETS_TABLE_LOAD_ERROR, "Error loading data for table: " + tableName, e);
        }
    }

    private Optional<String> getSheetExpressionForTable(String tableName)
    {
        Map<String, Optional<String>> tableSheetMap = getAllTableSheetExpressionMapping();
        if (!tableSheetMap.containsKey(tableName)) {
            return Optional.empty();
        }
        return tableSheetMap.get(tableName);
    }

    private Map<String, Optional<String>> getAllTableSheetExpressionMapping()
    {
        ImmutableMap.Builder<String, Optional<String>> tableSheetMap = ImmutableMap.builder();
        List<List<Object>> data = readAllValuesFromSheetExpression(metadataSheetId);
        // first line is assumed to be sheet header
        for (int i = 1; i < data.size(); i++) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check the underlying cause stack trace for the actual Google API error (401/403/404/quota).
  2. Verify sheets credentials configuration (sheets.secrets/credentials) and that the service account still has access to the spreadsheet.
  3. Validate the sheet expression URL/gid in the mapping file is correct and the sheet still exists.
  4. Retry after resolving quota/network issues; reduce refresh frequency if rate-limited.

Example fix

// before (mapping)
{"sales": "https://docs.google.com/spreadsheets/d/OLDID#gid=99"} -- deleted gid
// after
{"sales": "https://docs.google.com/spreadsheets/d/ACTIVEID#gid=0"} -- valid, accessible sheet
Defensive patterns

Strategy: try-catch

Validate before calling

-- verify access outside Presto first
curl -H "Authorization: Bearer $TOKEN" "https://sheets.googleapis.com/v4/spreadsheets/SPREADSHEET_ID/values/A1:B2";

Try / catch

try { return readTable(tableName); } catch (PrestoException e) { if (e.getErrorCode().getName().equals("SHEETS_TABLE_LOAD_ERROR")) { inspectCause(e); // 401/403: fix creds; 403 quota: backoff; 404: fix gid
 return retryWithBackoff(tableName); } throw e; }

Prevention

When it happens

Trigger: Google Sheets API errors while loading data: invalid/expired credentials or API key, wrong sheet range/expression, network failures, quota exhaustion, or the spreadsheet deleted/private after mapping.

Common situations: Expired or missing OAuth credentials, spreadsheet shared without access for the service account, gid/range in the mapping edited incorrectly, Google API rate limits hit.

Related errors


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