prestodb/presto · error · PrestoException
SHEETS_UNKNOWN_TABLE_ERROR
SHEETS_UNKNOWN_TABLE_ERROR
Error message
Sheet expression not found for table
What it means
SheetsClient.readAllValues throws SHEETS_UNKNOWN_TABLE_ERROR when the table-to-sheet mapping cache returns no sheet expression for the requested table name. The Google Sheets connector only knows tables declared in the metadata (sheet id/name mapping), so an unknown name means the table is not configured.
Source
Thrown at presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsClient.java:151
for (int i = 1; i < tableMetadata.size(); i++) {
if (tableMetadata.get(i).size() > 0) {
tables.add(String.valueOf(tableMetadata.get(i).get(0)));
}
}
return tables.build();
}
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);
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Check the table name spelling/case against the mapping file referenced by sheets-tables-location property.
- Verify the mapping JSON contains an entry for this table and the file is readable by the coordinator.
- Reload/restart the connector or clear stale caches after editing the mapping.
- Recreate the table metadata (SHOW TABLES in the sheets schema) to confirm what the connector exposes.
Example fix
// before (mapping file)
{"sales": "https://docs.google.com/spreadsheets/d/ID#gid=0"}
SELECT * FROM sheets.default.sale; -- typo
// after
SELECT * FROM sheets.default.sales; -- matches mapping key Defensive patterns
Strategy: validation
Validate before calling
-- before querying, confirm the table is exposed SHOW TABLES FROM sheets.default; -- verify the table name exists and matches spelling
Type guard
boolean isKnownSheetTable(String tableName, Set<String> knownTables) { return knownTables.contains(tableName); } Try / catch
try { return sheetsTable(tableName); } catch (PrestoException e) { if (e.getErrorCode().getName().equals("SHEETS_UNKNOWN_TABLE_ERROR")) { reloadTableMapping(); return sheetsTable(tableName); } throw e; } Prevention
- Keep table names in the sheets-tables-location mapping consistent with all queries.
- Reload the connector after editing the mapping file.
- Use SHOW TABLES/DESCRIBE to discover exact names and casing.
- Remove or update views referencing dropped tables.
When it happens
Trigger: Querying a sheets table whose name is absent from the configured table/sheet mapping (sheets-tables-location JSON), a typo in the table name, or the mapping file changed after the metadata was cached.
Common situations: Typos or case mismatches in table names, mapping file edited or moved without restarting/reloading the connector, table dropped from the mapping while a view still references it.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/9fb81418dc443af7.
Report an issue: GitHub.