{"id":"8ae9c47a31f3f03e","repo":"docker/cli","slug":"no-replica-count","errorCode":null,"errorMessage":"no replica count","messagePattern":"no replica count","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/service/progress/progress.go","lineNumber":296,"sourceCode":"\t\terrMsg = errMsg[:maxWidth-1] + \"…\"\n\t}\n\treturn errMsg\n}\n\ntype replicatedProgressUpdater struct {\n\tprogressOut progress.Output\n\n\t// used for mapping slots to a contiguous space\n\t// this also causes progress bars to appear in order\n\tslotMap map[int]int\n\n\tinitialized bool\n\tdone        bool\n}\n\nfunc (u *replicatedProgressUpdater) update(service swarm.Service, tasks []swarm.Task, activeNodes map[string]struct{}, rollback bool) (bool, error) {\n\tif service.Spec.Mode.Replicated == nil || service.Spec.Mode.Replicated.Replicas == nil {\n\t\treturn false, errors.New(\"no replica count\")\n\t}\n\treplicas := *service.Spec.Mode.Replicated.Replicas\n\n\tif !u.initialized {\n\t\tu.slotMap = make(map[int]int)\n\n\t\t// Draw progress bars in order\n\t\twriteOverallProgress(u.progressOut, 0, int(replicas), rollback)\n\n\t\tif replicas <= maxProgressBars {\n\t\t\tfor i := uint64(1); i <= replicas; i++ {\n\t\t\t\tprogress.Update(u.progressOut, fmt.Sprintf(\"%d/%d\", i, replicas), \" \")\n\t\t\t}\n\t\t}\n\t\tu.initialized = true\n\t}\n\n\ttasksBySlot := u.tasksBySlot(tasks, activeNodes)","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/service/progress/progress.go#L278-L314","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","If a custom API client created the service, always set the Replicas pointer on swarm.ReplicatedService.","Re-issue the update once the conflicting change settles, or use --detach to skip live progress."],"exampleFix":"// before\nspec.Mode = swarm.ServiceMode{Replicated: &swarm.ReplicatedService{}}\n// after\nreplicas := uint64(3)\nspec.Mode = swarm.ServiceMode{Replicated: &swarm.ReplicatedService{Replicas: &replicas}}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker","swarm","cli","progress","race-condition","service-mode"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}