{"record":{"id":"390e755286ea78d4","repo":"GoogleContainerTools/jib","slug":"multiple-valid-main-classes-were-found-mainclas","errorCode":null,"errorMessage":"Multiple valid main classes were found: ${mainClasses}","messagePattern":"Multiple valid main classes were found: (.+?)","errorType":"exception","errorClass":"MainClassInferenceException","httpStatus":null,"severity":"error","filePath":"jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/MainClassResolver.java","lineNumber":102,"sourceCode":"case MULTIPLE_MAIN_CLASSES:\n  throw new MainClassInferenceException(\n      HelpfulSuggestions.forMainClassNotFound(\n          \"Multiple valid main classes were found: \"\n              + String.join(\", \", mainClassFinderResult.getFoundMainClasses()),\n          projectProperties.getPluginName()));","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/MainClassResolver.java#L84-L120","documentation":"MainClassInferenceException thrown by MainClassResolver.resolveMainClass() when MainClassFinder.find() returns MULTIPLE_MAIN_CLASSES: scanning all class files produced more than one class with a valid main method, so Jib cannot choose an entrypoint unambiguously. The message lists the comma-separated candidates (mainClasses). This fires when no mainClass is configured and the classpath contains several runnable mains (e.g. test utilities, tools, legacy entrypoints).","triggerScenarios":"Thrown at jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/MainClassResolver.java:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Explicitly configure the desired main class so inference is skipped entirely","Exclude the unwanted main classes from the compiled output, or move helper mains out of the production classes","Keep only one class with 'public static void main' in the module if auto-detection is desired"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}