docker/cli ยท error

duplicate config target for %s not allowed

Error message

duplicate config target for %s not allowed

What it means

Error "duplicate config target for %s not allowed" thrown in docker/cli.

Source

Thrown at cli/command/service/parse.go:99

	runtimeRefs := make(map[string]*swarm.ConfigReference)

	for _, config := range requestedConfigs {
		// copy the config, so we don't mutate the args
		configRef := new(swarm.ConfigReference)
		*configRef = *config

		if config.Runtime != nil {
			// by assigning to a map based on ConfigName, if the same Config
			// is required as a Runtime target for multiple purposes, we only
			// include it once in the final set of configs.
			runtimeRefs[config.ConfigName] = config
			// continue, so we skip the logic below for handling file-type
			// configs
			continue
		}

		if _, exists := configRefs[config.File.Name]; exists {
			return nil, fmt.Errorf("duplicate config target for %s not allowed", config.ConfigName)
		}

		configRefs[config.File.Name] = configRef
	}

	args := make(client.Filters)
	for _, s := range configRefs {
		args.Add("name", s.ConfigName)
	}
	for _, s := range runtimeRefs {
		args.Add("name", s.ConfigName)
	}

	res, err := apiClient.ConfigList(ctx, client.ConfigListOptions{
		Filters: args,
	})
	if err != nil {
		return nil, err

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/service/parse.go:99 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/9701a743821b50ad.json. Report an issue: GitHub.