apache/flink · critical · FlinkException

Failed to execute job '{jobName}'.

Error message

Failed to execute job '{jobName}'.

What it means

FlinkException thrown by ExecutionEnvironmentImpl.executeAsync/execute when the PipelineExecutor's returned future completes exceptionally. The original failure is stripped of its ExecutionException wrapper and attached as the cause, with the StreamGraph's job name interpolated into the message.

Source

Thrown at flink-datastream/src/main/java/org/apache/flink/datastream/impl/ExecutionEnvironmentImpl.java:311

            Throwable strippedException = ExceptionUtils.stripExecutionException(t);
            ExceptionUtils.rethrowException(strippedException);
        }
    }

    private JobClient executeAsync(StreamGraph streamGraph) throws Exception {
        checkNotNull(streamGraph, "StreamGraph cannot be null.");
        final PipelineExecutor executor = getPipelineExecutor();

        CompletableFuture<JobClient> jobClientFuture =
                executor.execute(streamGraph, configuration, getClass().getClassLoader());

        try {
            // TODO Supports job listeners.
            return jobClientFuture.get();
        } catch (ExecutionException executionException) {
            final Throwable strippedException =
                    ExceptionUtils.stripExecutionException(executionException);
            throw new FlinkException(
                    String.format("Failed to execute job '%s'.", streamGraph.getJobName()),
                    strippedException);
        }
    }

    /** Get {@link StreamGraph} and clear all transformations. */
    public StreamGraph getStreamGraph() {
        final StreamGraph streamGraph = getStreamGraphGenerator(transformations).generate();
        transformations.clear();
        return streamGraph;
    }

    private StreamGraphGenerator getStreamGraphGenerator(List<Transformation<?>> transformations) {
        if (transformations.size() <= 0) {
            throw new IllegalStateException(
                    "No operators defined in streaming topology. Cannot execute.");
        }

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Inspect the stripped cause via exception.getCause() — the real failure is never this message itself
  2. Verify DeploymentOptions.TARGET ('local', 'remote', 'yarn', ...) matches the executor dependencies on your classpath
  3. Check the cluster/JobManager is reachable and the deployment options (address, parallelism, jars) are valid
  4. If the cause is a classloader/ServiceLoader error, confirm the executor service provider JAR is present

Example fix

// before
JobClient client = env.execute("my-job");

// after
try {
    JobClient client = env.execute("my-job");
} catch (FlinkException e) {
    log.error("Submission failed, root cause: {}", e.getCause());
    throw e;
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
    env.execute(jobName);
} catch (FlinkException e) {
    Throwable root = ExceptionUtils.stripExecutionException(e.getCause() != null ? e.getCause() : e);
    // act on root: connectivity, executor factory, config
    throw new RuntimeException("submission failed: " + root, root);
}

Prevention

When it happens

Trigger: env.execute() where job submission fails: missing executor factory for the configured target, cluster unreachable, invalid DeploymentOptions.TARGET, classloader issues loading the executor, or any failure inside PipelineExecutor.execute(...).

Common situations: Wrong execution.target configuration (e.g. no flink-kubernetes dependency for 'kubernetes-session'), JobManager not running at the configured address, missing executor JARs on the classpath, or the executor failing during StreamGraph→ExecutionGraph translation.

Related errors


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