{"record":{"id":"bc8d1057c12460b8","repo":"apache/flink","slug":"problem-with-jar-file","errorCode":null,"errorMessage":"Problem with jar file {}","messagePattern":"Problem with jar file (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/util/JarUtils.java","lineNumber":76,"sourceCode":"    }\n\n    public static List<URL> getJarFiles(final String[] jars) {\n        if (jars == null) {\n            return Collections.emptyList();\n        }\n\n        return Arrays.stream(jars)\n                .map(\n                        jarPath -> {\n                            try {\n                                final URL fileURL =\n                                        new File(jarPath).getAbsoluteFile().toURI().toURL();\n                                JarUtils.checkJarFile(fileURL);\n                                return fileURL;\n                            } catch (MalformedURLException e) {\n                                throw new IllegalArgumentException(\"JAR file path invalid\", e);\n                            } catch (IOException e) {\n                                throw new RuntimeException(\"Problem with jar file \" + jarPath, e);\n                            }\n                        })\n                .collect(Collectors.toList());\n    }\n}\n","sourceCodeStart":58,"sourceCodeEnd":82,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/util/JarUtils.java#L58-L82","documentation":"JarUtils.getJarFiles wraps the checks from checkJarFile: any IOException thrown while validating a jar path (invalid URI, missing file, unreadable, corrupt archive) is rethrown as this RuntimeException naming the problematic jarPath. It is the single failure surface for 'resolve an array of jar path strings to validated URLs'.","triggerScenarios":"Calling JarUtils.getJarFiles(jars) where any element fails checkJarFile: nonexistent path, no read permission, or not a valid jar archive.","commonSituations":"Command-line or configuration entries (e.g. python/SQL client extra jars, SQL gateway session jars) referencing missing or broken jar files; paths valid on the client machine but absent on the gateway/cluster; permission problems in shared artifact directories.","solutions":["Read the jarPath in the message and the nested IOException cause — the cause tells you which checkJarFile check failed (existence, readability, or jar validity).","Fix that underlying condition per its own guidance: correct the path, chmod the file, or replace a corrupt jar.","Validate all jar paths on the machine that executes getJarFiles before submitting (a quick Files.exists + Files.isReadable pass).","Use absolute paths or ship jars with the job to avoid client-vs-cluster path drift."],"exampleFix":"// before\nList<URL> urls = JarUtils.getJarFiles(new String[] {\"lib/missing.jar\"}); // RuntimeException\n\n// after\nString[] jars = Stream.of(args)\n        .filter(p -> Files.isReadable(Paths.get(p)))\n        .toArray(String[]::new);\nList<URL> urls = JarUtils.getJarFiles(jars);","handlingStrategy":"validation","validationCode":"for (String jar : jars) {\n    Path p = Paths.get(jar);\n    if (!Files.isReadable(p) || !Files.isRegularFile(p)) {\n        throw new IllegalArgumentException(\"Jar unusable on this node: \" + p.toAbsolutePath());\n    }\n}\nList<URL> urls = JarUtils.getJarFiles(jars);","typeGuard":null,"tryCatchPattern":"try {\n    urls = JarUtils.getJarFiles(jars);\n} catch (RuntimeException e) {\n    IOException cause = (IOException) e.getCause();\n    // branch on cause message: missing / unreadable / corrupt\n}","preventionTips":["Pre-validate jar paths with Files.isReadable before calling getJarFiles","Keep jars on paths valid for every node that touches the job","Fail fast at config parse time with the offending path in the message"],"tags":["jar","classpath","configuration","deployment"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}