prestodb/presto · error · PrestoException

GENERIC_INTERNAL_ERROR

GENERIC_INTERNAL_ERROR

Error message

Explain format not supported: 

What it means

ExplainAnalyzeOperator.getOutput renders the analyzed plan for the requested explain format (TEXT or JSON) of the output stage. If the ExplainType is anything else, the default branch throws GENERIC_INTERNAL_ERROR since ExplainAnalyze only supports those formats by design.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/ExplainAnalyzeOperator.java:166

        }

        QueryInfo queryInfo = queryPerformanceFetcher.getQueryInfo(operatorContext.getDriverContext().getTaskId().getQueryId());
        checkState(queryInfo.getOutputStage().isPresent(), "Output stage is missing");
        checkState(queryInfo.getOutputStage().get().getSubStages().size() == 1, "Expected one sub stage of explain node");

        if (!hasFinalStageInfo(queryInfo.getOutputStage().get())) {
            return null;
        }
        String plan;
        switch (format) {
            case TEXT:
                plan = textDistributedPlan(queryInfo.getOutputStage().get().getSubStages().get(0), functionAndTypeManager, operatorContext.getSession(), verbose);
                break;
            case JSON:
                plan = jsonDistributedPlan(queryInfo.getOutputStage().get().getSubStages().get(0), functionAndTypeManager, operatorContext.getSession());
                break;
            default:
                throw new PrestoException(GENERIC_INTERNAL_ERROR, "Explain format not supported: " + format);
        }

        BlockBuilder builder = VARCHAR.createBlockBuilder(null, 1);
        VARCHAR.writeString(builder, plan);

        outputConsumed = true;
        return new Page(builder.build());
    }

    private boolean hasFinalStageInfo(StageInfo stageInfo)
    {
        boolean isFinalStageInfo = isFinalStageInfo(stageInfo);
        if (!isFinalStageInfo) {
            try {
                TimeUnit.MILLISECONDS.sleep(100);
            }
            catch (InterruptedException e) {
                throw new RuntimeException(e);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use EXPLAIN ANALYZE FORMAT TEXT or FORMAT JSON only
  2. Run plain EXPLAIN (without ANALYZE) for formats like GRAPHVIZ
  3. Upgrade Presto if a newer version adds support for the desired format

Example fix

-- before
EXPLAIN ANALYZE FORMAT GRAPHVIZ SELECT 1;
-- after
EXPLAIN ANALYZE FORMAT JSON SELECT 1;
Defensive patterns

Strategy: validation

Validate before calling

Set<String> supported = Set.of("TEXT", "JSON");
if (!supported.contains(explainFormat)) {
    // use plain EXPLAIN instead of EXPLAIN ANALYZE
    throw new IllegalArgumentException("EXPLAIN ANALYZE supports only TEXT/JSON: " + explainFormat);
}

Prevention

When it happens

Trigger: An EXPLAIN ANALYZE statement specifies an explain format other than TEXT or JSON (e.g. EXPLAIN ANALYZE FORMAT GRAPHVIZ), causing the switch in getOutput to fall through to default.

Common situations: Users run EXPLAIN ANALYZE FORMAT GRAPHVIZ or FORMAT XML expecting parity with plain EXPLAIN, which supports more formats.

Related errors


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