{"record":{"id":"9fb81418dc443af7","repo":"prestodb/presto","slug":"sheets-unknown-table-error","errorCode":"SHEETS_UNKNOWN_TABLE_ERROR","errorMessage":"Sheet expression not found for table ","messagePattern":"Sheet expression not found for table ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsClient.java","lineNumber":151,"sourceCode":"            for (int i = 1; i < tableMetadata.size(); i++) {\n                if (tableMetadata.get(i).size() > 0) {\n                    tables.add(String.valueOf(tableMetadata.get(i).get(0)));\n                }\n            }\n            return tables.build();\n        }\n        catch (UncheckedExecutionException e) {\n            throwIfInstanceOf(e.getCause(), PrestoException.class);\n            throw new PrestoException(SHEETS_METASTORE_ERROR, e);\n        }\n    }\n\n    public List<List<Object>> readAllValues(String tableName)\n    {\n        try {\n            Optional<String> sheetExpression = tableSheetMappingCache.getUnchecked(tableName);\n            if (!sheetExpression.isPresent()) {\n                throw new PrestoException(SHEETS_UNKNOWN_TABLE_ERROR, \"Sheet expression not found for table \" + tableName);\n            }\n            return sheetDataCache.getUnchecked(sheetExpression.get());\n        }\n        catch (UncheckedExecutionException e) {\n            throwIfInstanceOf(e.getCause(), PrestoException.class);\n            throw new PrestoException(SHEETS_TABLE_LOAD_ERROR, \"Error loading data for table: \" + tableName, e);\n        }\n    }\n\n    private Optional<String> getSheetExpressionForTable(String tableName)\n    {\n        Map<String, Optional<String>> tableSheetMap = getAllTableSheetExpressionMapping();\n        if (!tableSheetMap.containsKey(tableName)) {\n            return Optional.empty();\n        }\n        return tableSheetMap.get(tableName);\n    }\n","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsClient.java#L133-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (mapping file)\n{\"sales\": \"https://docs.google.com/spreadsheets/d/ID#gid=0\"}\nSELECT * FROM sheets.default.sale; -- typo\n// after\nSELECT * FROM sheets.default.sales; -- matches mapping key","handlingStrategy":"validation","validationCode":"-- before querying, confirm the table is exposed\nSHOW TABLES FROM sheets.default; -- verify the table name exists and matches spelling","typeGuard":"boolean isKnownSheetTable(String tableName, Set<String> knownTables) { return knownTables.contains(tableName); }","tryCatchPattern":"try { return sheetsTable(tableName); } catch (PrestoException e) { if (e.getErrorCode().getName().equals(\"SHEETS_UNKNOWN_TABLE_ERROR\")) { reloadTableMapping(); return sheetsTable(tableName); } throw e; }","preventionTips":["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."],"tags":["google-sheets","connector","unknown-table","config"],"backgroundTag":"unknown-table-mapping","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"}