docker/cli ยท error

multiple services found with provided prefix: %s

Error message

multiple services found with provided prefix: %s

What it means

Emitted by `docker service ps` when a given argument matches no full service ID or name but is a prefix of two or more service IDs. The prefix-match loop at ps.go:123-132 sets `found` on the first prefix hit and errors on a second hit, because the CLI cannot decide which service the user meant.

Source

Thrown at cli/command/service/ps.go:126

		for _, s := range serviceByID.Items {
			if s.ID == service {
				filter.Add("service", s.ID)
				serviceCount++
				continue loop
			}
		}
		for _, s := range serviceByName.Items {
			if s.Spec.Annotations.Name == service {
				filter.Add("service", s.ID)
				serviceCount++
				continue loop
			}
		}
		found := false
		for _, s := range serviceByID.Items {
			if strings.HasPrefix(s.ID, service) {
				if found {
					return filter, nil, errors.New("multiple services found with provided prefix: " + service)
				}
				filter.Add("service", s.ID)
				serviceCount++
				found = true
			}
		}
		if !found {
			notfound = append(notfound, "no such service: "+service)
		}
	}
	if serviceCount == 0 {
		return filter, nil, errors.New(strings.Join(notfound, "\n"))
	}
	return filter, notfound, err
}

func updateNodeFilter(ctx context.Context, apiClient client.APIClient, filter client.Filters) error {
	if nodeFilters, ok := filter["node"]; ok {

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Use a longer, unique ID prefix or the full 25-char service ID
  2. Use the exact service name instead of an ID prefix
  3. Run `docker service ls --no-trunc` to see full IDs and disambiguate

Example fix

# before
docker service ps a1
# multiple services found with provided prefix: a1

# after
docker service ps a1b2c3d4e5   # unique prefix
# or
docker service ps mystack_web

When it happens

Trigger: `docker service ps <prefix>` where <prefix> (e.g. 'a1') is a leading substring of the IDs of at least two services returned by ServiceList, and matches no exact ID or name.

Common situations: Using a very short ID prefix (1-3 chars) on a swarm with many services; scripts that truncate IDs before passing them to the CLI; copy-pasting a partial ID from truncated `docker service ls` output that happens to collide.

Related errors


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