{"record":{"id":"dad8912e9e7a3d25","repo":"junit-team/junit5","slug":"configuration-error-s","errorCode":null,"errorMessage":"Configuration error: %s.","messagePattern":"Configuration error: (.+?)\\.","errorType":"exception","errorClass":"PreconditionViolationException","httpStatus":null,"severity":"error","filePath":"junit-jupiter-params/src/main/java/org/junit/jupiter/params/ResolverFacade.java","lineNumber":386,"sourceCode":"\t\t\t\t\tparameterName(actualDeclaration), parameterIndex));\n\t\t\t}\n\t\t\telse if (errors.isEmpty()) {\n\t\t\t\tparameterDeclarationMapping.put(actualDeclaration, originalDeclaration);\n\t\t\t}\n\t\t}\n\t\treturn errors;\n\t}\n\n\tprivate static String parameterName(ParameterDeclaration actualDeclaration) {\n\t\treturn actualDeclaration.getParameterName().map(name -> \" '\" + name + \"'\").orElse(\"\");\n\t}\n\n\tprivate static <T> T configurationErrorOrSuccess(List<String> errors, Supplier<T> successfulResult) {\n\t\tif (errors.isEmpty()) {\n\t\t\treturn successfulResult.get();\n\t\t}\n\t\telse if (errors.size() == 1) {\n\t\t\tthrow new PreconditionViolationException(\"Configuration error: \" + errors.get(0) + \".\");\n\t\t}\n\t\telse {\n\t\t\tthrow new PreconditionViolationException(\"%d configuration errors:%n%s\".formatted(errors.size(),\n\t\t\t\terrors.stream().collect(joining(lineSeparator() + \"- \", \"- \", \"\"))));\n\t\t}\n\t}\n\n\tprivate static void validateIndexedParameters(\n\t\t\tNavigableMap<Integer, List<FieldParameterDeclaration>> indexedParameters, List<String> errors) {\n\n\t\tif (indexedParameters.isEmpty()) {\n\t\t\treturn;\n\t\t}\n\n\t\tindexedParameters.forEach(\n\t\t\t(index, declarations) -> validateIndexedParameterDeclarations(index, declarations, errors));\n\n\t\tfor (int index = 0; index <= indexedParameters.lastKey(); index++) {","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ResolverFacade.java#L368-L404","documentation":"Thrown by ResolverFacade.configurationErrorOrSuccess() when there is exactly one configuration error detected during validation of parameter/field declarations for a parameterized test or class. The method accumulates error messages in a List and, if exactly one error exists, formats it as 'Configuration error: <message>.' The error message comes from validation logic that checks parameter declarations, aggregator declarations, and field parameter declarations for issues like duplicate aggregators, invalid parameter indices, or type mismatches.","triggerScenarios":"Exactly one validation error is found when resolving parameters for a @ParameterizedTest method or @ParameterizedClass constructor/fields. For example: a single @AggregateWith annotation on a non-aggregatable parameter, a single @Parameter field with an invalid index, or one parameter type that can't be resolved by any registered resolver.","commonSituations":"Parameterized test methods where one parameter has an incompatible @ConvertWith or @AggregateWith annotation. @ParameterizedClass fields where one @Parameter field index is out of range. A single parameter declaration that conflicts with JUnit's resolution rules (e.g., two parameters mapping to the same index but only one is flagged at this pass).","solutions":["Read the specific error message after 'Configuration error:' — it identifies the exact parameter/field and issue","Check @Parameter indices, @ConvertWith/@AggregateWith annotations, and parameter types against the argument source","Ensure there are no duplicate or conflicting parameter declarations","For @ParameterizedClass, verify @Parameter field indices are contiguous starting from 0"],"exampleFix":"// before — invalid parameter annotation\n@ParameterizedTest\n@CsvSource({ \"1,hello\" })\nvoid test(@ConvertWith(MyStringConverter.class) int number, String text) {\n    // MyStringConverter tries to convert to int → configuration error\n}\n\n// after — correct annotation or type\n@ParameterizedTest\n@CsvSource({ \"1,hello\" })\nvoid test(int number, String text) { }","handlingStrategy":"validation","validationCode":"// Pre-validate parameter annotations on a @ParameterizedTest method\nimport java.lang.reflect.Parameter;\nimport java.lang.reflect.Method;\n\nstatic void validateParameterizedTestParams(Method testMethod) {\n    for (Parameter p : testMethod.getParameters()) {\n        boolean hasConvertWith = p.isAnnotationPresent(org.junit.jupiter.params.converter.ConvertWith.class);\n        boolean hasAggregateWith = p.isAnnotationPresent(org.junit.jupiter.params.AggregateWith.class);\n        // Check for known issues: conflicting annotations, invalid types, etc.\n        if (hasConvertWith && hasAggregateWith) {\n            throw new IllegalStateException(\n                \"Parameter \" + p.getName() + \" cannot have both @ConvertWith and @AggregateWith\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Review the full error message — it identifies the exact parameter and the nature of the configuration problem","Validate parameter annotations match the argument source shape before running tests","Ensure @Parameter indices are within the argument source's column range"],"tags":["configuration","parameter-resolution","validation","junit-params"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}