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

  1. Correct quarkus.main-class to the fully qualified class name of your main class
  2. Or set it to the exact 'name' value of one of your @QuarkusMain annotations
  3. Verify the main class is compiled and included in the application dependencies
  4. 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

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


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/bb0e8592d18db464. Report an issue: GitHub.