{"record":{"id":"47b661f6f9733a5f","repo":"GoogleContainerTools/jib","slug":"dependency-required-by-the-jar-as-specified-in-c","errorCode":null,"errorMessage":"Dependency required by the JAR (as specified in `Class-Path` in the JAR manifest) doesn't exist: ${fullDepPath}","messagePattern":"Dependency required by the JAR \\(as specified in `Class-Path` in the JAR manifest\\) doesn't exist: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarLayers.java","lineNumber":100,"sourceCode":"            path ->\n                addDependency(\n                    snapshotLayer,\n                    jarParent.resolve(path),\n                    mode.equals(ProcessingMode.packaged)\n                        ? APP_ROOT.resolve(path)\n                        : APP_ROOT\n                            .resolve(ArtifactLayers.DEPENDENCIES)\n                            .resolve(path.getFileName())));\n        layers.add(snapshotLayer.build());\n      }\n      return layers;\n    }\n  }\n\n  private static void addDependency(\n      FileEntriesLayer.Builder layerbuilder, Path fullDepPath, AbsoluteUnixPath pathOnContainer) {\n    if (!Files.exists(fullDepPath)) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Dependency required by the JAR (as specified in `Class-Path` in the JAR manifest) doesn't exist: %s\",\n              fullDepPath));\n    }\n    layerbuilder.addEntry(fullDepPath, pathOnContainer);\n  }\n}\n","sourceCodeStart":82,"sourceCodeEnd":108,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarLayers.java#L82-L108","documentation":"When containerizing an exploded/fat JAR, Jib reads the `Class-Path` attribute of the JAR manifest to find dependency JARs and adds each as a layer entry. If a referenced dependency file does not exist on disk at the resolved path, addDependency throws this IllegalArgumentException instead of silently producing a broken image.","triggerScenarios":"Calling JarLayers.getDependenciesLayers on a JAR whose MANIFEST.MF `Class-Path` entry lists a dependency path that does not resolve to an existing file (relative paths resolved against the JAR's directory are missing, moved, or deleted).","commonSituations":"Copying the JAR without its sibling lib/ directory; the manifest Class-Path built with absolute paths on a different machine; renamed or version-bumped dependency JARs; building a thin JAR outside its original layout.","solutions":["Restore the missing dependency JAR to the path referenced in the JAR's Class-Path manifest attribute","Run `unzip -p app.jar META-INF/MANIFEST.MF` to inspect Class-Path and verify each path exists relative to the JAR's directory","Rebuild/repackage the JAR so dependencies are present or use a fat JAR without external Class-Path references"],"exampleFix":"// before\napp.jar            // manifest Class-Path: lib/dep-1.0.jar\nlib/               // missing\n// after\napp.jar\nlib/dep-1.0.jar    // dependency restored","handlingStrategy":"validation","validationCode":"String cp = manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH);\nif (cp != null) for (String p : cp.split(\" \")) { if (!Files.exists(jarDir.resolve(p.trim()))) throw new IllegalStateException(\"Missing dep: \" + p); }","typeGuard":null,"tryCatchPattern":"try { layers = jarProcessor.getLayers(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Class-Path\")) { /* repair deps or repackage */ } }","preventionTips":["Always distribute the JAR with its full lib/ directory","Verify Class-Path entries resolve relative to the JAR before containerizing","Prefer fat JARs or explicit dependency lists over manifest Class-Path"],"tags":["jib","jar","manifest","classpath","missing-file"],"backgroundTag":"file-not-found","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}