{"record":{"id":"bb0e8592d18db464","repo":"quarkusio/quarkus","slug":"the-supplied-main-class-value-of-mainclassnam","errorCode":null,"errorMessage":"The supplied 'main-class' value of '${mainClassName}' does not correspond to either a fully qualified class name or a matching 'name' field of one of the '@QuarkusMain' annotations","messagePattern":"The supplied 'main-class' value of '(.+?)' does not correspond to either a fully qualified class name or a matching 'name' field of one of the '@QuarkusMain' annotations","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java","lineNumber":478,"sourceCode":"                mainClassMethod = classByName\n                        .method(\"main\", STRING_ARRAY);\n            }\n            if (mainClassMethod == null) {\n                boolean found = false;\n                for (ClassInfo i : impls) {\n                    if (i.name().toString().equals(mainClassName)) {\n                        found = true;\n                        break;\n                    }\n                }\n                if (found) {\n                    //this is QuarkusApplication, generate a real main to run it\n                    generateMainForQuarkusApplication(mainClassName, generatedClass);\n                    mainClassName = MAIN_CLASS;\n                } else {\n                    ClassInfo classInfo = index.getClassByName(DotName.createSimple(mainClassName));\n                    if (classInfo == null) {\n                        throw new IllegalArgumentException(\"The supplied 'main-class' value of '\" + mainClassName\n                                + \"' does not correspond to either a fully qualified class name or a matching 'name' field of one of the '@QuarkusMain' annotations\");\n                    }\n                }\n            }\n        }\n\n        if (!mainClassName.equals(MAIN_CLASS) && ((mainClassMethod == null) || !Modifier.isPublic(mainClassMethod.flags()))) {\n            transformedClass.produce(new BytecodeTransformerBuildItem(mainClassName, new MainMethodTransformer(index)));\n        }\n\n        return new MainClassBuildItem(mainClassName);\n    }\n\n    private static String sanitizeMainClassName(ClassInfo mainClass, IndexView index) {\n        DotName mainClassDotName = mainClass.name();\n        String className = mainClassDotName.toString();\n        if (isKotlinClass(mainClass)) {\n            MethodInfo mainMethod = mainClass.method(\"main\",","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java#L460-L496","documentation":"When quarkus.main-class is set, Quarkus accepts either a fully qualified class name or the 'name' attribute of a @QuarkusMain annotation. If the supplied value matches neither an indexed class nor any registered @QuarkusMain name, this IllegalArgumentException is thrown.","triggerScenarios":"During mainClassBuildStep: -Dquarkus.main-class (or application.properties quarkus.main-class) value is not a QuarkusApplication/Application class in the index and not a @QuarkusMain name, and the index lookup getClassByName returns null.","commonSituations":"Typos in the quarkus.main-class value; passing a @QuarkusMain name but misspelling it or renaming the class; the main class lives in a module not on the deployment classpath; using a short class name instead of the FQCN.","solutions":["Correct quarkus.main-class to the fully qualified class name of your main class","Or set it to the exact 'name' value of one of your @QuarkusMain annotations","Verify the main class is compiled and included in the application dependencies","List available @QuarkusMain classes and confirm the name matches (case-sensitive)"],"exampleFix":"// before\nquarkus.main-class=MyMain\n// after\nquarkus.main-class=com.acme.MyMain\n// or quarkus.main-class=my-named-main (matching @QuarkusMain(name=\"my-named-main\"))","handlingStrategy":"validation","validationCode":"String mc = System.getProperty(\"quarkus.main-class\", \"\");\nboolean ok = mc.isEmpty()\n    || mc.contains(\".\") && classExists(mc)  // FQCN\n    || quarkusMainNames().contains(mc);      // @QuarkusMain name\nif (!ok) throw new IllegalStateException(\"Invalid quarkus.main-class: \" + mc);","typeGuard":null,"tryCatchPattern":"try {\n    quarkusBuild();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"does not correspond to either a fully qualified class name\")) {\n        // correct the quarkus.main-class value\n    }\n    throw e;\n}","preventionTips":["Use fully qualified class names in quarkus.main-class","Keep the value in sync with @QuarkusMain name attributes (case-sensitive)","Verify the main class is on the application classpath before setting the property","After renames, update both the class and the quarkus.main-class property"],"tags":["quarkus","config","main-class","build-time"],"backgroundTag":"invalid-config-value","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}