{"record":{"id":"f731bbee41dd59b5","repo":"hashicorp/nomad","slug":"deployment-id-q-couldn-t-be-updated-as-it-does-no","errorCode":null,"errorMessage":"Deployment ID %q couldn't be updated as it does not exist","messagePattern":"Deployment ID %q couldn't be updated as it does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store.go","lineNumber":4809,"sourceCode":"\t}\n\tif req.Eval != nil {\n\t\tif err := s.nestedUpsertEval(txn, index, req.Eval); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn txn.Commit()\n}\n\n// updateDeploymentStatusImpl is used to make deployment status updates\nfunc (s *StateStore) updateDeploymentStatusImpl(index uint64, u *structs.DeploymentStatusUpdate, txn *txn) error {\n\t// Retrieve deployment\n\tws := memdb.NewWatchSet()\n\tdeployment, err := s.deploymentByIDImpl(ws, u.DeploymentID, txn)\n\tif err != nil {\n\t\treturn err\n\t} else if deployment == nil {\n\t\treturn fmt.Errorf(\"Deployment ID %q couldn't be updated as it does not exist\", u.DeploymentID)\n\t} else if !deployment.Active() {\n\t\treturn fmt.Errorf(\"Deployment %q has terminal status %q:\", deployment.ID, deployment.Status)\n\t}\n\n\t// Apply the new status\n\tcopy := deployment.Copy()\n\tcopy.Status = u.Status\n\tcopy.StatusDescription = u.StatusDescription\n\tcopy.ModifyIndex = index\n\tcopy.ModifyTime = u.UpdatedAt\n\n\t// check each TaskGroup for ProgressDeadline and reset RequireProgressBy\n\t// to ProgressDeadline if the deployment is running or paused. This is to\n\t// ensure that the RequireProgressBy is reset on a deployment that has been\n\t// paused and resumed.\n\tfor _, dState := range copy.TaskGroups {\n\t\tif dState == nil || dState.ProgressDeadline == 0 {\n\t\t\tcontinue","sourceCodeStart":4791,"sourceCodeEnd":4827,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store.go#L4791-L4827","documentation":"Returned by UpdateDeploymentStatus when the deployment ID referenced in the status update request does not exist in the state store. This is a logical/consistency error: the client tried to mark a deployment via structs.DeploymentStatusUpdate whose DeploymentID has no matching record.","triggerScenarios":"DeploymentStatusUpdate raft operation with a DeploymentID that was never created or has since been garbage collected (e.g. job deregistration removed the deployment).","commonSituations":"Scheduler/RPC racing with job deletion; clients caching a stale deployment ID; replaying an old evaluation against a rebuilt state store.","solutions":["Verify the deployment ID exists (nomad deployment status <id>) before updating","Re-fetch the deployment from the state store; drop the update if it was GC'd","Ensure the job/deployment is not deregistered concurrently","Re-run the deployment flow to create a fresh deployment"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"dep, _, err := state.DeploymentByID(nil, u.DeploymentID)\nif err != nil { return err }\nif dep == nil {\n  return fmt.Errorf(\"deployment %s no longer exists; skipping update\", u.DeploymentID)\n}","typeGuard":"func deploymentActive(s *state.StateStore, id string) bool {\n  d, _, err := s.DeploymentByID(nil, id)\n  return err == nil && d != nil && d.Active()\n}","tryCatchPattern":"err := srv.raft.Apply(updateReq).Error()\nif err != nil && strings.Contains(err.Error(), \"does not exist\") {\n  // deployment was GC'd; drop the update instead of failing the eval\n}","preventionTips":["Re-fetch the deployment before applying status updates","Handle job deletion removing deployments","Drop updates for GC'd deployment IDs"],"tags":["nomad","state-store","deployment","not-found"],"backgroundTag":"deployment-not-found","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"}