prestodb/presto · error · TableNotFoundException

TableNotFoundException

Error message

TableNotFoundException

What it means

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.

Source

Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusMetadata.java:126

    public List<SchemaTableName> listTables(ConnectorSession session, Optional<String> schemaName)
    {
        Set<String> schemaNames = schemaName.map(ImmutableSet::of)
                .orElseGet(() -> ImmutableSet.copyOf(ImmutableSet.of("default")));

        return schemaNames.stream()
                .flatMap(thisSchemaName ->
                        prometheusClient.getTableNames(thisSchemaName).stream().map(tableName -> new SchemaTableName(thisSchemaName, tableName)))
                .collect(toImmutableList());
    }

    @Override
    public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle)
    {
        PrometheusTableHandle prometheusTableHandle = (PrometheusTableHandle) tableHandle;

        PrometheusTable table = prometheusClient.getTable(prometheusTableHandle.getSchemaName(), prometheusTableHandle.getTableName());
        if (table == null) {
            throw new TableNotFoundException(prometheusTableHandle.toSchemaTableName());
        }

        ImmutableMap.Builder<String, ColumnHandle> columnHandles = ImmutableMap.builder();
        int index = 0;
        for (ColumnMetadata column : table.getColumnsMetadata()) {
            columnHandles.put(column.getName(), new PrometheusColumnHandle(column.getName(), column.getType(), index));
            index++;
        }
        return columnHandles.build();
    }

    @Override
    public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle)
    {
        return ((PrometheusColumnHandle) columnHandle).getColumnMetadata();
    }

    @Override

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the metric/table name exists in Prometheus (SHOW TABLES or query Prometheus directly)
  2. Re-run metadata refresh if the metric was just created
  3. Check the configured Prometheus server availability
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusMetadata.java:126 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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