{"record":{"id":"86638cd17a52ca45","repo":"prestodb/presto","slug":"tablenotfoundexception","errorCode":null,"errorMessage":"TableNotFoundException","messagePattern":"TableNotFoundException","errorType":"error_code","errorClass":"TableNotFoundException","httpStatus":null,"severity":"error","filePath":"presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusMetadata.java","lineNumber":126,"sourceCode":"    public List<SchemaTableName> listTables(ConnectorSession session, Optional<String> schemaName)\n    {\n        Set<String> schemaNames = schemaName.map(ImmutableSet::of)\n                .orElseGet(() -> ImmutableSet.copyOf(ImmutableSet.of(\"default\")));\n\n        return schemaNames.stream()\n                .flatMap(thisSchemaName ->\n                        prometheusClient.getTableNames(thisSchemaName).stream().map(tableName -> new SchemaTableName(thisSchemaName, tableName)))\n                .collect(toImmutableList());\n    }\n\n    @Override\n    public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle)\n    {\n        PrometheusTableHandle prometheusTableHandle = (PrometheusTableHandle) tableHandle;\n\n        PrometheusTable table = prometheusClient.getTable(prometheusTableHandle.getSchemaName(), prometheusTableHandle.getTableName());\n        if (table == null) {\n            throw new TableNotFoundException(prometheusTableHandle.toSchemaTableName());\n        }\n\n        ImmutableMap.Builder<String, ColumnHandle> columnHandles = ImmutableMap.builder();\n        int index = 0;\n        for (ColumnMetadata column : table.getColumnsMetadata()) {\n            columnHandles.put(column.getName(), new PrometheusColumnHandle(column.getName(), column.getType(), index));\n            index++;\n        }\n        return columnHandles.build();\n    }\n\n    @Override\n    public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle)\n    {\n        return ((PrometheusColumnHandle) columnHandle).getColumnMetadata();\n    }\n\n    @Override","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusMetadata.java#L108-L144","documentation":"Guard in PrometheusMetadata.getColumnHandles: the requested Prometheus table has no known columns, so a TableNotFoundException is thrown for the schema-qualified name. Fires when a query references a table (metric) that the client cannot resolve, or the metric disappeared between listing and metadata lookup.","triggerScenarios":"Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusMetadata.java:126 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the metric/table name exists in Prometheus (SHOW TABLES or query Prometheus directly)","Re-run metadata refresh if the metric was just created","Check the configured Prometheus server availability"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}