junit-team/junit5 · error · CommandLine.ParameterException

Duplicate key '%s' for values '%s' and '%s'.

Error message

Duplicate key '%s' for values '%s' and '%s'.

What it means

Error "Duplicate key '%s' for values '%s' and '%s'." thrown in junit-team/junit5.

Source

Thrown at junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java:242

		 * on the command line.
		 *
		 * @param map the key-value pairs to add
		 * @throws CommandLine.ParameterException if the map already contains this key
		 * @see <a href="https://github.com/junit-team/junit-framework/issues/1308">#1308</a>
		 */
		@Option(names = "--config", paramLabel = "KEY=VALUE", arity = "1", description = "Set a configuration parameter for test discovery and execution. This option can be repeated.")
		public void setConfigurationParameters(Map<String, String> map) {
			for (String key : map.keySet()) {
				String newValue = map.get(key);
				validateUnique(key, newValue);
				configurationParameters.put(key, newValue);
			}
		}

		private void validateUnique(String key, String newValue) {
			String existing = configurationParameters.get(key);
			if (existing != null && !existing.equals(newValue)) {
				throw new CommandLine.ParameterException(spec.commandLine(),
					"Duplicate key '%s' for values '%s' and '%s'.".formatted(key, existing, newValue));
			}
		}

		private void applyTo(TestDiscoveryOptions result) {
			result.setAdditionalClasspathEntries(additionalClasspathEntries);
			result.setConfigurationParametersResources(configurationParametersResources);
			result.setConfigurationParameters(configurationParameters);
		}
	}

	public TestDiscoveryOptions toTestDiscoveryOptions() {
		TestDiscoveryOptions result = new TestDiscoveryOptions();
		if (this.selectorOptions != null) {
			this.selectorOptions.applyTo(result);
		}
		if (this.filterOptions != null) {
			this.filterOptions.applyTo(result);

View on GitHub (pinned to 956246301e)

When it happens

Trigger: Thrown at junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java:242 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04). Data as JSON: /data/errors/1b90f3e909eecc28.json. Report an issue: GitHub.