prestodb/presto · error · TableNotFoundException

TABLE_NOT_FOUND

TABLE_NOT_FOUND

Error message

Table '${tableName}' not found

What it means

Split generation guard in PrometheusSplitManager.getSplits: the table (metric) referenced by the layout handle cannot be found in the Prometheus client's table metadata, so a not-found error naming the table is thrown. Commonly occurs when the metric is deleted or renamed while a query is executing.

Source

Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusSplitManager.java:189

                        Duration.timeUnitToString(queryChunkSizeDuration.getUnit()) + "]")
                .addParameter("time", time)
                .build();
    }

    @Override
    public ConnectorSplitSource getSplits(
            ConnectorTransactionHandle transactionHandle,
            ConnectorSession session,
            ConnectorTableLayoutHandle layout,
            SplitSchedulingContext splitSchedulingContext)
    {
        PrometheusTableLayoutHandle layoutHandle = (PrometheusTableLayoutHandle) layout;
        PrometheusTableHandle tableHandle = layoutHandle.getTableHandle();
        PrometheusTable table = prometheusClient.getTable(tableHandle.getSchemaName(), tableHandle.getTableName());

        // this can happen if table is removed during a query
        if (table == null) {
            throw new TableNotFoundException(tableHandle.toSchemaTableName());
        }
        List<ConnectorSplit> splits = generateTimesForSplits(prometheusClock.now(), maxQueryRangeDuration, queryChunkSizeDuration, tableHandle)
                .stream()
                .map(time -> {
                    try {
                        return new PrometheusSplit(buildQuery(
                                prometheusURI,
                                time,
                                table.getName(),
                                queryChunkSizeDuration));
                    }
                    catch (URISyntaxException e) {
                        throw new PrestoException(PROMETHEUS_UNKNOWN_ERROR, "split URI invalid: " + e.getMessage());
                    }
                }).collect(Collectors.toList());
        return new FixedSplitSource(splits);
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Confirm the metric still exists in Prometheus
  2. Re-issue the query; concurrent metric removal is transient
  3. Check Prometheus scrape/target health for the metric series
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusSplitManager.java:189 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/2210d58964f37fee. Report an issue: GitHub.