{"record":{"id":"6ad0b32218cc1c4e","repo":"apache/flink","slug":"cannot-access-jar-file-t-getmessage-null","errorCode":null,"errorMessage":"Cannot access jar file{t.getMessage() == null ? \".\" : \": \" + t.getMessage()}","messagePattern":"Cannot access jar file(.+?)","errorType":"exception","errorClass":"ProgramInvocationException","httpStatus":null,"severity":"error","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java","lineNumber":623,"sourceCode":"                                    && name.startsWith(\"lib/\")\n                                    && name.endsWith(\".jar\");\n                        })\n                .collect(Collectors.toList());\n    }\n\n    private static void deleteExtractedLibraries(List<File> tempLibraries) {\n        for (File f : tempLibraries) {\n            f.delete();\n        }\n    }\n\n    private static void checkJarFile(URL jarfile) throws ProgramInvocationException {\n        try {\n            JarUtils.checkJarFile(jarfile);\n        } catch (IOException e) {\n            throw new ProgramInvocationException(e.getMessage(), e);\n        } catch (Throwable t) {\n            throw new ProgramInvocationException(\n                    \"Cannot access jar file\"\n                            + (t.getMessage() == null ? \".\" : \": \" + t.getMessage()),\n                    t);\n        }\n    }\n\n    @Override\n    public void close() {\n        try {\n            userCodeClassLoader.close();\n        } catch (IOException e) {\n            LOG.debug(\"Error while closing user-code classloader.\", e);\n        }\n        try {\n            deleteExtractedLibraries();\n        } catch (Exception e) {\n            LOG.debug(\"Error while deleting jars extracted from user-jar.\", e);\n        }","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java#L605-L641","documentation":"A catch-all (Throwable) thrown when JarUtils.checkJarFile throws something that is not an IOException — e.g., a SecurityException, RuntimeException, or Error. The message includes the throwable's message if non-null, or a period if null. This guards against unexpected failures during jar accessibility checks.","triggerScenarios":"A security manager denies read access to the jar, a custom protocol handler for the URL throws a non-IO exception, or an internal assertion in JarUtils fails.","commonSituations":"Security manager or SELinux blocking file reads, custom URL stream handlers behaving incorrectly, or classpath/resource access restrictions in a sandboxed environment.","solutions":["Read the chained Throwable to identify the non-IO failure type.","If SecurityException, grant FilePermission or relevant read permissions.","Check SELinux/AppArmor labels on the jar file.","Disable custom URL stream handler factories if in use."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    PackagedProgram.newBuilder().setJarFile(jarFile).build();\n} catch (ProgramInvocationException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof SecurityException) {\n        // grant FilePermission or check SELinux\n    }\n    throw e;\n}","preventionTips":["Ensure the Flink process has read permissions on all jar files.","Check SELinux/AppArmor labels if running under Linux security modules.","Avoid running Flink with an overly restrictive security manager."],"tags":["packaged-program","jar","security","catch-all","validation"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}