prestodb/presto · error · PrestoException

GENERIC_INTERNAL_ERROR

GENERIC_INTERNAL_ERROR

Error message

Scheduling is complete, but stage execution %s is in state %s

What it means

Invariant failure in SqlQueryScheduler.schedule: the scheduler has no remaining work, yet a stage execution is not in a plausible terminal state. This indicates an internal state-machine inconsistency during query scheduling rather than a user error, and the query is aborted.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/scheduler/SqlQueryScheduler.java:556

                        break;
                    }

                    // wait for a state change and then schedule again
                    if (allBlocked && !blockedStages.isEmpty()) {
                        try (TimeStat.BlockTimer timer = schedulerStats.getSleepTime().time()) {
                            tryGetFutureValue(whenAnyComplete(blockedStages), 1, SECONDS);
                        }
                    }
                    for (ListenableFuture<?> blockedStage : blockedStages) {
                        blockedStage.cancel(true);
                    }
                }
            }

            for (StageExecutionAndScheduler stageExecutionInfo : scheduledStageExecutions) {
                StageExecutionState state = stageExecutionInfo.getStageExecution().getState();
                if (state != SCHEDULED && state != RUNNING && !state.isDone()) {
                    throw new PrestoException(GENERIC_INTERNAL_ERROR, format("Scheduling is complete, but stage execution %s is in state %s", stageExecutionInfo.getStageExecution().getStageExecutionId(), state));
                }
            }

            scheduling.set(false);

            // Inform the tracker that task scheduling has completed
            partialResultQueryTaskTracker.completeTaskScheduling();

            if (!getSectionsReadyForExecution().isEmpty()) {
                startScheduling();
            }
        }
        catch (Throwable t) {
            scheduling.set(false);
            queryStateMachine.transitionToFailed(t);
            throw t;
        }
        finally {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Retry the query; this is a rare internal race in stage state handling
  2. Upgrade to a Presto version containing the scheduler state-machine fix if it recurs
  3. Report the incident with the query ID and full coordinator logs
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/scheduler/SqlQueryScheduler.java:556 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/6061d64a2f96a9e6. Report an issue: GitHub.