{"record":{"id":"6889fa7364f94232","repo":"quarkusio/quarkus","slug":"your-application-must-be-built-with-parameter-name","errorCode":null,"errorMessage":"Your application must be built with parameter names, this should be the default if using Quarkus project generation. Check the Maven or Gradle compiler configuration to include '-parameters'. When using Kotlin data classes with value classes or default parameters, Panache skips synthetic constructors automatically; if this error persists, annotate the constructor with @ProjectedConstructor or annotate parameters with @ProjectedFieldName.","messagePattern":"Your application must be built with parameter names, this should be the default if using Quarkus project generation\\. Check the Maven or Gradle compiler configuration to include '-parameters'\\. When using Kotlin data classes with value classes or default parameters, Panache skips synthetic constructors automatically; if this error persists, annotate the constructor with @ProjectedConstructor or annotate parameters with @ProjectedFieldName\\.","errorType":"exception","errorClass":"PanacheQueryException","httpStatus":null,"severity":"error","filePath":"extensions/panache/panache-hibernate-common/runtime/src/main/java/io/quarkus/panache/hibernate/common/runtime/ProjectionConstructorUtil.java","lineNumber":110,"sourceCode":"            return selectedConstructor;\n        }\n\n        for (Constructor<?> constructor : constructors) {\n            if (constructor.getParameterCount() > 0) {\n                throw new PanacheQueryException(buildNoSuitableConstructorMessage(type, constructor));\n            }\n        }\n        throw new PanacheQueryException(\"No suitable projection constructor found for \" + type.getName()\n                + \". Projection DTOs require a constructor with at least one parameter.\");\n    }\n\n    public static String getProjectionParameterName(Class<?> parentType, String parentParameter, Parameter parameter,\n            BiFunction<Class<?>, String, String> nestedProjectionBuilder) {\n        String parameterName;\n        if (hasProjectedFieldName(parameter)) {\n            parameterName = getNameFromProjectedFieldName(parameter);\n        } else if (!parameter.isNamePresent()) {\n            throw new PanacheQueryException(\n                    \"Your application must be built with parameter names, this should be the default if\"\n                            + \" using Quarkus project generation. Check the Maven or Gradle compiler configuration to include '-parameters'.\"\n                            + \" When using Kotlin data classes with value classes or default parameters, Panache skips synthetic\"\n                            + \" constructors automatically; if this error persists, annotate the constructor with @ProjectedConstructor\"\n                            + \" or annotate parameters with @ProjectedFieldName.\");\n        } else {\n            try {\n                Field field = parentType.getDeclaredField(parameter.getName());\n                parameterName = hasProjectedFieldName(field) ? getNameFromProjectedFieldName(field)\n                        : parameter.getName();\n            } catch (NoSuchFieldException e) {\n                parameterName = parameter.getName();\n            }\n        }\n        parameterName = parentParameter == null ? parameterName : parentParameter + \".\" + parameterName;\n        if (hasNestedProjectedClass(parameter.getType())) {\n            return nestedProjectionBuilder.apply(parameter.getType(), parameterName);\n        }","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/panache/panache-hibernate-common/runtime/src/main/java/io/quarkus/panache/hibernate/common/runtime/ProjectionConstructorUtil.java#L92-L128","documentation":"ProjectionConstructorUtil.getProjectionParameterName needs the Java reflection parameter name to map a select item to the DTO constructor parameter. If Parameter.isNamePresent() is false — meaning the class was compiled without the -parameters flag (and no @ProjectedFieldName/@ProjectedConstructor annotations help) — Panache throws this descriptive exception explaining the build configuration fix and the annotation fallbacks.","triggerScenarios":"Using project(Dto.class) where the DTO class was compiled without -parameters and constructor parameters have no @ProjectedFieldName annotations; common when the DTO comes from a dependency jar or a Kotlin module with synthetic constructors.","commonSituations":"Maven/Gradle project not using Quarkus project generation defaults (compiler plugin lacks <parameters>true</parameters> or compileJava { options.compilerArgs << '-parameters' }); DTOs built in a separate module or library without -parameters; Kotlin data classes with value classes/default parameters where synthetic constructors were not skipped.","solutions":["Enable -parameters in the compiler config: Maven maven-compiler-plugin <parameters>true</parameters> or Gradle tasks.withType(JavaCompile) { options.compilerArgs += ['-parameters'] }","Annotate each constructor parameter with @ProjectedFieldName(\"entityFieldName\") to supply names explicitly","Annotate the constructor with @ProjectedConstructor so Panache selects and maps it explicitly","If the DTO is in a third-party jar, rebuild it with -parameters or use annotation-based mapping via a local wrapper DTO","For Kotlin, avoid synthetic constructors (value classes/default params) or use the annotations above"],"exampleFix":"// before (Maven)\n<plugin>\n  <artifactId>maven-compiler-plugin</artifactId>\n</plugin>\n\n// after\n<plugin>\n  <artifactId>maven-compiler-plugin</artifactId>\n  <configuration>\n    <parameters>true</parameters>\n  </configuration>\n</plugin>","handlingStrategy":"validation","validationCode":"// fail fast at startup if the DTO lacks parameter names\nstatic void assertParameterNamesAvailable(Class<?> dto) throws NoSuchMethodException {\n    for (java.lang.reflect.Constructor<?> c : dto.getConstructors()) {\n        if (c.getParameterCount() > 0 && !c.getParameters()[0].isNamePresent()) {\n            throw new IllegalStateException(\"Compile with -parameters or annotate \" + dto + \" with @ProjectedFieldName\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    return query.project(Dto.class).list();\n} catch (PanacheQueryException e) {\n    if (e.getMessage().contains(\"-parameters\")) {\n        throw new IllegalStateException(\"Build configuration problem: enable -parameters\", e);\n    }\n    throw e;\n}","preventionTips":["Quarkus project generation enables -parameters by default — keep it when customizing the build","Verify -parameters survives changes to maven-compiler-plugin/Gradle java plugin config","For DTOs from external jars, always use @ProjectedFieldName since you can't control their compilation","In multi-module builds, apply the compiler flag to every module containing projection DTOs"],"tags":["panache","jpa","reflection","compiler-flags","projection"],"backgroundTag":"missing-parameters-compiler-flag","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}