docker/cli · error

no replica count

Error message

no replica count

What it means

Returned by replicatedProgressUpdater.update, the progress renderer for replicated services, when the service it is polling has Spec.Mode.Replicated nil or a nil Replicas pointer. The updater needs the replica count to compute the progress denominator; a missing count means the service spec changed out from under it or was malformed, so it aborts rather than divide against nothing.

Source

Thrown at cli/command/service/progress/progress.go:296

		errMsg = errMsg[:maxWidth-1] + "…"
	}
	return errMsg
}

type replicatedProgressUpdater struct {
	progressOut progress.Output

	// used for mapping slots to a contiguous space
	// this also causes progress bars to appear in order
	slotMap map[int]int

	initialized bool
	done        bool
}

func (u *replicatedProgressUpdater) update(service swarm.Service, tasks []swarm.Task, activeNodes map[string]struct{}, rollback bool) (bool, error) {
	if service.Spec.Mode.Replicated == nil || service.Spec.Mode.Replicated.Replicas == nil {
		return false, errors.New("no replica count")
	}
	replicas := *service.Spec.Mode.Replicated.Replicas

	if !u.initialized {
		u.slotMap = make(map[int]int)

		// Draw progress bars in order
		writeOverallProgress(u.progressOut, 0, int(replicas), rollback)

		if replicas <= maxProgressBars {
			for i := uint64(1); i <= replicas; i++ {
				progress.Update(u.progressOut, fmt.Sprintf("%d/%d", i, replicas), " ")
			}
		}
		u.initialized = true
	}

	tasksBySlot := u.tasksBySlot(tasks, activeNodes)

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Avoid changing the service's mode or spec while a create/update progress watch is running; re-run `docker service ps <svc>` to check actual state.
  2. If a custom API client created the service, always set the Replicas pointer on swarm.ReplicatedService.
  3. Re-issue the update once the conflicting change settles, or use --detach to skip live progress.

Example fix

// before
spec.Mode = swarm.ServiceMode{Replicated: &swarm.ReplicatedService{}}
// after
replicas := uint64(3)
spec.Mode = swarm.ServiceMode{Replicated: &swarm.ReplicatedService{Replicas: &replicas}}

When it happens

Trigger: During `docker service create/update` progress monitoring (--detach=false), a subsequent ServiceInspect returns a spec whose Mode.Replicated or Replicas is nil — e.g. the service was concurrently updated to global mode mid-rollout, or an API client wrote a Replicated mode without setting Replicas.

Common situations: Concurrent `docker service update --mode global` (or other mode change) while another terminal is watching a rollout; automation that mutates the service spec via the API during deployment; malformed specs from custom tooling leaving Replicas nil.

Related errors


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