quarkusio/quarkus · error · IllegalArgumentException
The supplied 'main-class' value of '${mainClassName}' does n
Error message
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 What it means
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.
Source
Thrown at core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java:478
mainClassMethod = classByName
.method("main", STRING_ARRAY);
}
if (mainClassMethod == null) {
boolean found = false;
for (ClassInfo i : impls) {
if (i.name().toString().equals(mainClassName)) {
found = true;
break;
}
}
if (found) {
//this is QuarkusApplication, generate a real main to run it
generateMainForQuarkusApplication(mainClassName, generatedClass);
mainClassName = MAIN_CLASS;
} else {
ClassInfo classInfo = index.getClassByName(DotName.createSimple(mainClassName));
if (classInfo == null) {
throw new IllegalArgumentException("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");
}
}
}
}
if (!mainClassName.equals(MAIN_CLASS) && ((mainClassMethod == null) || !Modifier.isPublic(mainClassMethod.flags()))) {
transformedClass.produce(new BytecodeTransformerBuildItem(mainClassName, new MainMethodTransformer(index)));
}
return new MainClassBuildItem(mainClassName);
}
private static String sanitizeMainClassName(ClassInfo mainClass, IndexView index) {
DotName mainClassDotName = mainClass.name();
String className = mainClassDotName.toString();
if (isKotlinClass(mainClass)) {
MethodInfo mainMethod = mainClass.method("main",View on GitHub (pinned to e1c734241f)
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)
Example fix
// before quarkus.main-class=MyMain // after quarkus.main-class=com.acme.MyMain // or quarkus.main-class=my-named-main (matching @QuarkusMain(name="my-named-main"))
Defensive patterns
Strategy: validation
Validate before calling
String mc = System.getProperty("quarkus.main-class", "");
boolean ok = mc.isEmpty()
|| mc.contains(".") && classExists(mc) // FQCN
|| quarkusMainNames().contains(mc); // @QuarkusMain name
if (!ok) throw new IllegalStateException("Invalid quarkus.main-class: " + mc); Try / catch
try {
quarkusBuild();
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().contains("does not correspond to either a fully qualified class name")) {
// correct the quarkus.main-class value
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Either @ConfigRoot or @ConfigMapping is missing on ${configR
- Unable to load the config property type: ${className}
- Unknown password type: ${passwordType}
- Invalid '<paramName>String' value "<value>" - cannot parse i
- Annotations '<annotations>' can only be used when proactive
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/bb0e8592d18db464.
Report an issue: GitHub.