{"record":{"id":"a7a846beaf36a1c9","repo":"GoogleContainerTools/jib","slug":"bug-in-jib-core-please-report-the-bug-at-github","errorCode":null,"errorMessage":"Bug in jib-core; please report the bug at <GitHub new issue URL>","messagePattern":"Bug in jib-core; please report the bug at <GitHub new issue URL>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/api/JavaContainerBuilder.java","lineNumber":659,"sourceCode":"      // Construct entrypoint. Ensure classpath elements are in the same order as the files were\n      // added to the JavaContainerBuilder.\n      List<String> classpathElements = new ArrayList<>();\n      for (LayerType path : classpathOrder) {\n        switch (path) {\n          case CLASSES:\n            classpathElements.add(appRoot.resolve(classesDestination).toString());\n            break;\n          case RESOURCES:\n            classpathElements.add(appRoot.resolve(resourcesDestination).toString());\n            break;\n          case DEPENDENCIES:\n            classpathElements.add(appRoot.resolve(dependenciesDestination).resolve(\"*\").toString());\n            break;\n          case EXTRA_FILES:\n            classpathElements.add(appRoot.resolve(othersDestination).toString());\n            break;\n          default:\n            throw new RuntimeException(\n                \"Bug in jib-core; please report the bug at \" + ProjectInfo.GITHUB_NEW_ISSUE_URL);\n        }\n      }\n      String classpathString = String.join(\":\", classpathElements);\n      List<String> entrypoint = new ArrayList<>(4 + jvmFlags.size());\n      entrypoint.add(\"java\");\n      entrypoint.addAll(jvmFlags);\n      entrypoint.add(\"-cp\");\n      entrypoint.add(classpathString);\n      entrypoint.add(mainClass);\n      jibContainerBuilder.setEntrypoint(entrypoint);\n    }\n\n    return jibContainerBuilder;\n  }\n\n  private JavaContainerBuilder addDirectory(\n      List<PathPredicatePair> addedPaths, Path directory, Predicate<Path> filter)","sourceCodeStart":641,"sourceCodeEnd":677,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/api/JavaContainerBuilder.java#L641-L677","documentation":"While assembling the classpath string, toContainerBuilder iterates LayerType values and throws a RuntimeException for any unrecognized type, labelling it a jib-core bug. This is an internal invariant/default-case guard — hitting it means a new LayerType enum constant was added without updating this switch, which is not user-fixable.","triggerScenarios":"Only reachable via an enum/switch inconsistency inside jib-core: a LayerType constant not handled by the switch in toContainerBuilder. Normal user code cannot trigger it through public APIs.","commonSituations":"Running a jib version with an internal bug, a patched/forked jib-core with a custom LayerType, or mixing mismatched jib artifact versions on the classpath.","solutions":["Report the bug at the jib GitHub issue tracker as the message instructs, including the jib version","Upgrade jib-core to the latest release where the switch covers all LayerType values","Check that you are not mixing incompatible jib artifact versions (e.g. a different jib-core on the classpath)","If using a fork, add a case for the new LayerType in toContainerBuilder"],"exampleFix":"// before\n<use affected jib-core version>\n// after\n<upgrade>\n// e.g. Maven:\n<dependency>\n  <groupId>com.google.cloud.tools</groupId>\n  <artifactId>jib-core</artifactId>\n  <version>0.27.2</version>\n</dependency>","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { JibContainerBuilder b = builder.toContainerBuilder(); } catch (RuntimeException e) { if (e.getMessage().contains(\"Bug in jib-core\")) { reportBug(e); } throw e; }","preventionTips":["Keep jib-core and jib plugin versions aligned and current","Never add custom LayerType constants via reflection or forks","Report any occurrence upstream with the full stack trace and jib version"],"tags":["jib","internal-bug","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}