{"record":{"id":"32579bbdc7120199","repo":"junit-team/junit5","slug":"systempropertyextension-was-configured-to-set-clea","errorCode":null,"errorMessage":"SystemPropertyExtension was configured to set/clear %s [%s] more than once by [%s].","messagePattern":"SystemPropertyExtension was configured to set/clear (.+?) \\[(.+?)\\] more than once by \\[(.+?)\\]\\.","errorType":"exception","errorClass":"ExtensionConfigurationException","httpStatus":null,"severity":"error","filePath":"junit-jupiter-api/src/main/java/org/junit/jupiter/api/util/SystemPropertiesModification.java","lineNumber":149,"sourceCode":"\t\t\t\t});\n\n\t\trequireUniqueEntries(element, duplicatePropertyNames);\n\t\treturn entries;\n\t}\n\n\tprivate static void requireNoClearAndSetSameEntries(AnnotatedElement element, Set<String> entriesToClear,\n\t\t\tSet<String> entriesToSet) {\n\t\trequireUniqueEntries(element, //\n\t\t\tentriesToClear.stream() //\n\t\t\t\t\t.filter(entriesToSet::contains) //\n\t\t\t\t\t.collect(toSet()));\n\t}\n\n\tprivate static void requireUniqueEntries(AnnotatedElement annotatedElement, Set<String> duplicatePropertNames) {\n\t\tif (duplicatePropertNames.isEmpty()) {\n\t\t\treturn;\n\t\t}\n\t\tthrow new ExtensionConfigurationException(\n\t\t\t\"SystemPropertyExtension was configured to set/clear %s [%s] more than once by [%s].\" //\n\t\t\t\t\t.formatted( //\n\t\t\t\t\t\tduplicatePropertNames.size() == 1 ? \"property\" : \"properties\", //\n\t\t\t\t\t\tString.join(\", \", duplicatePropertNames), //\n\t\t\t\t\t\tannotatedElement //\n\t\t\t\t\t));\n\t}\n}\n","sourceCodeStart":131,"sourceCodeEnd":158,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/util/SystemPropertiesModification.java#L131-L158","documentation":"ExtensionConfigurationException from SystemPropertiesModification.requireUniqueEntries, raised when the same system-property key is set/cleared more than once by the same @SetSystemProperty / @ClearSystemProperty annotations on one element — either two @SetSystemProperty(key=...) with the same key, or both a clear and a set for the same key. The extension refuses ambiguous configurations rather than applying one nondeterministically.","triggerScenarios":"Repeated @SetSystemProperty(key=\"foo\", value=\"a\") and @SetSystemProperty(key=\"foo\", value=\"b\") on one test; or @ClearSystemProperty(key=\"foo\") together with @SetSystemProperty(key=\"foo\", ...) on the same element. findEntriesToSet detects duplicate keys; requireNoClearAndSetSameEntries detects clear∩set overlap.","commonSituations":"Merging annotations from a base test and an override; composing meta-annotations that both set the same key; copy-paste of a SetSystemProperty leaving a duplicate key behind.","solutions":["Deduplicate @SetSystemProperty entries on the element so each key appears at most once.","Remove either the @ClearSystemProperty or the @SetSystemProperty for a key that has both — pick one intent.","If you need different values per test, split into separate test methods or use a parameter source."],"exampleFix":"// before\n@SetSystemProperty(key = \"foo\", value = \"a\")\n@SetSystemProperty(key = \"foo\", value = \"b\")\nvoid test() {}\n// after\n@SetSystemProperty(key = \"foo\", value = \"a\")\nvoid test() {}","handlingStrategy":"validation","validationCode":"Set<String> setKeys = new HashSet<>();\nfor (SetSystemProperty a : element.getAnnotationsByType(SetSystemProperty.class)) {\n    if (!setKeys.add(a.key())) { /* duplicate set key */ }\n}\nSet<String> clearKeys = Arrays.stream(element.getAnnotationsByType(ClearSystemProperty.class))\n        .map(ClearSystemProperty::key).collect(toSet());\nsetKeys.retainAll(clearKeys);\nif (!setKeys.isEmpty()) { /* clear+set conflict */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Each system-property key should appear in at most one @SetSystemProperty per element.","Never combine @ClearSystemProperty and @SetSystemProperty for the same key.","Watch for inherited/meta-annotations that re-add the same key."],"tags":["system-properties","duplicate-key","annotation-misuse","extension-config"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}