{"record":{"id":"026527a7ae10ff75","repo":"hashicorp/nomad","slug":"cannot-update-alloc-to-connect-in-place-026527","errorCode":null,"errorMessage":"cannot update alloc to Connect in-place","messagePattern":"cannot update alloc to Connect in-place","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/consul_http_sock_hook.go","lineNumber":136,"sourceCode":"\tfor _, proxy := range h.proxies {\n\t\tif err := proxy.run(h.alloc); err != nil {\n\t\t\tmErr = multierror.Append(mErr, err)\n\t\t}\n\t}\n\treturn mErr.ErrorOrNil()\n}\n\nfunc (h *consulHTTPSockHook) Update(req *interfaces.RunnerUpdateRequest) error {\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\n\th.alloc = req.Alloc\n\n\tif !h.shouldRun() {\n\t\treturn nil\n\t}\n\tif len(h.proxies) == 0 {\n\t\treturn fmt.Errorf(\"cannot update alloc to Connect in-place\")\n\t}\n\n\tvar mErr *multierror.Error\n\tfor _, proxy := range h.proxies {\n\t\tif err := proxy.run(h.alloc); err != nil {\n\t\t\tmErr = multierror.Append(mErr, err)\n\t\t}\n\t}\n\treturn mErr.ErrorOrNil()\n}\n\nfunc (h *consulHTTPSockHook) Postrun() error {\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\n\tfor _, proxy := range h.proxies {\n\t\tif err := proxy.stop(); err != nil {\n\t\t\t// Only log failures to stop proxies. Worst case scenario is a small","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/consul_http_sock_hook.go#L118-L154","documentation":"The Consul HTTP socket hook (consul_http_sock_hook) manages Connect sidecar proxies for an allocation. On Update, Nomad tries to apply a group service change in place by re-running each existing proxy. If h.proxies is empty there is no proxy process to re-run, so an in-place update to enable Connect is impossible and the hook fails fast with this error.","triggerScenarios":"Updating an allocation's job spec to ADD Consul Connect (service.connect block) to a group that was previously scheduled without Connect, so no proxy was started during Prestart; the Update hook then has no proxies to run.","commonSituations":"Editing a job in-place (nomad job run on an existing alloc) to add a connect sidecar_service for the first time; enabling Connect via a jobspec change instead of rescheduling.","solutions":["Reschedule the allocation (stop the old job / use nomad job stop -purge or change the job so allocs are replaced) instead of in-place update","Force a destructive update: add a wildcard to the job's task/group or change a field that prevents in-place update, e.g. update stanza with canary/rolling","Restart the allocation with nomad alloc restart or nomad job stop then run the updated job","Ensure the group had connect services at initial scheduling so proxies are created in Prestart"],"exampleFix":"// before: in-place edit adds Connect to a running alloc\nnomad job run app.nomad  // app.nomad now includes connect sidecar_service\n\n// after: stop and resubmit so allocs are replaced\nnomad job stop app && nomad job run app.nomad","handlingStrategy":"fallback","validationCode":"// before submitting an in-place job update, check whether the change adds Connect to a group that lacked it:\nold := previousJob.TaskGroups[i].Services\nnew := updatedJob.TaskGroups[i].Services\naddsConnect := !hasConnect(old) && hasConnect(new)\nif addsConnect { planReschedule = true }","typeGuard":"func requiresReschedule(old, new *api.TaskGroup) bool {\n\treturn connectServiceCount(old) == 0 && connectServiceCount(new) > 0\n}","tryCatchPattern":"if err := jobRunErr; err != nil && strings.Contains(err.Error(), \"cannot update alloc to Connect in-place\") {\n\t// fallback: stop and resubmit the job so allocs are replaced\n\tclient.Jobs().Deregister(jobID, false, nil)\n\t_, _, err = client.Jobs().Register(updatedJob, nil)\n}","preventionTips":["Plan job updates with nomad job plan before running to detect destructive vs in-place changes","Enable Connect services at initial job submission, not via later in-place edits","Use canary/rolling update stanzas so Connect changes replace allocations"],"tags":["consul","connect","in-place-update","proxies"],"backgroundTag":"in-place-update-not-supported","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}