apache/flink · critical · FlinkRuntimeException

Could not create the Dispatcher rpc endpoint.

Error message

Could not create the Dispatcher rpc endpoint.

What it means

Thrown by ApplicationDispatcherGatewayServiceFactory.create when the Dispatcher RPC endpoint cannot be created. The factory assembles PartialDispatcherServicesWithPersistenceComponents and constructs a Dispatcher; if any step in this assembly chain throws (RPC service initialization failure, persistence store errors, job recovery failures, configuration problems), the exception is caught and wrapped in a FlinkRuntimeException. This occurs during application-mode cluster startup.

Source

Thrown at flink-clients/src/main/java/org/apache/flink/client/deployment/application/ApplicationDispatcherGatewayServiceFactory.java:150

        try {
            dispatcher =
                    dispatcherFactory.createDispatcher(
                            rpcService,
                            fencingToken,
                            recoveredJobs,
                            recoveredDirtyJobResults,
                            recoveredApplications,
                            recoveredDirtyApplicationResults,
                            (dispatcherGateway, scheduledExecutor, errorHandler) ->
                                    new ApplicationBootstrap(bootstrapApplication),
                            PartialDispatcherServicesWithPersistenceComponents.from(
                                    partialDispatcherServices,
                                    executionPlanWriter,
                                    jobResultStore,
                                    applicationStore,
                                    applicationResultStore));
        } catch (Exception e) {
            throw new FlinkRuntimeException("Could not create the Dispatcher rpc endpoint.", e);
        }

        dispatcher.start();

        return DefaultDispatcherGatewayService.from(dispatcher);
    }

    private List<JobInfo> getRecoveredJobInfos(final Collection<ExecutionPlan> recoveredJobs) {
        return recoveredJobs.stream()
                .map(
                        executionPlan ->
                                new JobInfoImpl(executionPlan.getJobID(), executionPlan.getName()))
                .collect(Collectors.toList());
    }

    private List<JobInfo> getRecoveredTerminalJobInfos(
            final Collection<JobResult> recoveredDirtyJobResults) {
        return recoveredDirtyJobResults.stream()

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Check the wrapped cause in the FlinkRuntimeException for the specific failure
  2. Verify the RPC port (rest.port and the internal RPC port) is available
  3. Ensure the HA storage path is writable and has sufficient disk space
  4. Clear or migrate the JobResultStore if it's corrupt from a failed previous run
  5. Verify ZooKeeper connectivity if high-availability is enabled
Defensive patterns

Strategy: try-catch

Try / catch

try {
    DispatcherGatewayService service = factory.create(partialDispatcherServices, ...);
} catch (FlinkRuntimeException e) {
    Throwable cause = e.getCause();
    LOG.error("Dispatcher creation failed: {}", cause.getMessage(), cause);
    // check for port conflicts, storage path issues, HA connectivity
    throw e;
}

Prevention

When it happens

Trigger: Dispatcher RPC service fails to bind to its configured port; the JobResultStore or ApplicationResultStore cannot be initialized (permissions, disk issues); recovered job state is corrupt or incompatible; the partial dispatcher services are missing required components.

Common situations: Port conflict on a shared host; persistent state directory (high-availability.storagePath) on a full or read-only filesystem; version upgrade where the old JobResultStore format is incompatible; misconfigured high-availability settings (e.g., ZooKeeper unreachable).

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/58a93297a9d6665e. Report an issue: GitHub.