apache/flink · critical · ProgramInvocationException

The program's entry point class '{className}' caused an exce

Error message

The program's entry point class '{className}' caused an exception during initialization: {t.getMessage()}

What it means

A catch-all (Throwable) fallback thrown when Class.forName fails for a reason not covered by ClassNotFoundException, ExceptionInInitializerError, or LinkageError. This captures unexpected Throwables during entry-point class loading. The message includes the throwable's message for diagnostics.

Source

Thrown at flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java:503

            throw new ProgramInvocationException(
                    "The program's entry point class '"
                            + className
                            + "' was not found in the jar file.",
                    e);
        } catch (ExceptionInInitializerError e) {
            throw new ProgramInvocationException(
                    "The program's entry point class '"
                            + className
                            + "' threw an error during initialization.",
                    e);
        } catch (LinkageError e) {
            throw new ProgramInvocationException(
                    "The program's entry point class '"
                            + className
                            + "' could not be loaded due to a linkage failure.",
                    e);
        } catch (Throwable t) {
            throw new ProgramInvocationException(
                    "The program's entry point class '"
                            + className
                            + "' caused an exception during initialization: "
                            + t.getMessage(),
                    t);
        } finally {
            if (contextCl != null) {
                Thread.currentThread().setContextClassLoader(contextCl);
            }
        }
    }

    /**
     * Takes all JAR files that are contained in this program's JAR file and extracts them to the
     * system's temp directory.
     *
     * @return The file names of the extracted temporary files.
     * @throws ProgramInvocationException Thrown, if the extraction process failed.

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Read the chained Throwable cause for the specific failure type and message.
  2. If the cause is JVM-internal (e.g., OutOfMemoryError), address the underlying resource issue.
  3. Disable any custom Java agents or bytecode instrumentation to isolate the failure.
  4. Reproduce locally with -verbose:class to trace the class loading attempt.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    PackagedProgram.newBuilder()
        .setJarFile(jarFile)
        .setEntryPointClassName(className)
        .build();
} catch (ProgramInvocationException e) {
    Throwable cause = e.getCause();
    // log cause class and message for diagnosis of unexpected Throwable
    throw e;
}

Prevention

When it happens

Trigger: Any Throwable escaping Class.forName that is not one of the three specific catch blocks — e.g., a custom Error subclass, an unchecked exception thrown by a custom ClassLoader hook, or a ThreadDeath in edge cases.

Common situations: Custom ClassLoader implementations that throw non-standard errors, agent instrumentation interfering with class loading, or JVM internal errors during class verification.

Related errors


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