{"record":{"id":"3a2131ad6d65b0c1","repo":"apache/flink","slug":"error-while-getting-the-program-description","errorCode":null,"errorMessage":"Error while getting the program description","messagePattern":"Error while getting the program description","errorType":"exception","errorClass":"ProgramInvocationException","httpStatus":null,"severity":"warning","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java","lineNumber":221,"sourceCode":"     */\n    @Nullable\n    public String getDescription() throws ProgramInvocationException {\n        if (ProgramDescription.class.isAssignableFrom(this.mainClass)) {\n\n            ProgramDescription descr;\n            try {\n                descr =\n                        InstantiationUtil.instantiate(\n                                this.mainClass.asSubclass(ProgramDescription.class),\n                                ProgramDescription.class);\n            } catch (Throwable t) {\n                return null;\n            }\n\n            try {\n                return descr.getDescription();\n            } catch (Throwable t) {\n                throw new ProgramInvocationException(\n                        \"Error while getting the program description\"\n                                + (t.getMessage() == null ? \".\" : \": \" + t.getMessage()),\n                        t);\n            }\n\n        } else {\n            return null;\n        }\n    }\n\n    /**\n     * This method assumes that the context environment is prepared, or the execution will be a\n     * local execution by default.\n     */\n    public void invokeInteractiveModeForExecution() throws ProgramInvocationException {\n        FlinkSecurityManager.monitorUserSystemExitForCurrentThread();\n        try {\n            callMainMethod(mainClass, args);","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java#L203-L239","documentation":"Thrown by PackagedProgram.getJobDescription() when the entry class implements ProgramDescription but its getDescription() call raised a Throwable. Note the silent null return when instantiation fails (catch-all returning null above); this exception is only for failures inside getDescription() itself.","triggerScenarios":"The user's main class implements org.apache.flink.api.common.ProgramDescription, the instance was created successfully, but invoking getDescription() on it throws. Common: getDescription() reads a resource/config that is missing, or it contains a bug.","commonSituations":"Custom job classes that implement ProgramDescription to provide a description for the web UI / plan visualization, but whose getDescription() relies on resources not packaged into the jar.","solutions":["Make getDescription() a pure, dependency-light method that returns a string without touching files or external state.","Ensure any resources/files read by getDescription() are packaged inside the job jar.","If the description is not needed, remove the ProgramDescription interface from the class so getJobDescription() silently returns null instead of failing.","Inspect the appended ': <message>' in the exception to find the root cause thrown by getDescription()."],"exampleFix":"// before\n@Override\npublic String getDescription() {\n    return Files.readString(Path.of(\"/etc/flink/job-desc.txt\")); // throws if missing\n}\n\n// after\n@Override\npublic String getDescription() {\n    return \"Fraud detection streaming job v2\";\n}","handlingStrategy":"try-catch","validationCode":"// If you implement ProgramDescription, unit-test getDescription() in isolation\nProgramDescription pd = (ProgramDescription) mainClass.getDeclaredConstructor().newInstance();\nString d = pd.getDescription(); // fails fast in tests, not at runtime\nassert d != null && !d.isEmpty();","typeGuard":null,"tryCatchPattern":"String desc;\ntry {\n    desc = packagedProgram.getJobDescription(); // may throw ProgramInvocationException\n} catch (ProgramInvocationException pie) {\n    desc = packagedProgram.getClass().getName(); // fallback description\n    log.warn(\"Could not obtain program description, using class name\", pie);\n}","preventionTips":["Keep getDescription() side-effect free and free of file/resource reads.","Unit test getDescription() as part of the job jar's test suite.","Drop the ProgramDescription interface if a description is not needed."],"tags":["packaged-program","program-description","manifest","job-plan"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}