{"record":{"id":"7220cc421f4750b5","repo":"hashicorp/nomad","slug":"can-t-unblock-terminal-deployment","errorCode":null,"errorMessage":"can't unblock terminal deployment","messagePattern":"can't unblock terminal deployment","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/errors.go","lineNumber":83,"sourceCode":"\tErrMissingAllocID             = errors.New(errMissingAllocID)\n\tErrIncompatibleFiltering      = errors.New(errIncompatibleFiltering)\n\tErrMalformedChooseParameter   = errors.New(errMalformedChooseParameter)\n\n\t// ErrResultPaginatorCreation is returned by list RPC handlers when the\n\t// result paginator cannot be built, for example when the server cannot\n\t// evaluate a requested filter expression. api.ResultPaginatorErrorContent\n\t// duplicates its message so the CLI can match it without importing structs.\n\t// Keep the two in sync.\n\tErrResultPaginatorCreation = errors.New(errResultPaginatorCreation)\n\n\tErrUnknownNode = errors.New(ErrUnknownNodePrefix)\n\n\tErrDeploymentTerminalNoCancel    = errors.New(errDeploymentTerminalNoCancel)\n\tErrDeploymentTerminalNoFail      = errors.New(errDeploymentTerminalNoFail)\n\tErrDeploymentTerminalNoPause     = errors.New(errDeploymentTerminalNoPause)\n\tErrDeploymentTerminalNoPromote   = errors.New(errDeploymentTerminalNoPromote)\n\tErrDeploymentTerminalNoResume    = errors.New(errDeploymentTerminalNoResume)\n\tErrDeploymentTerminalNoUnblock   = errors.New(errDeploymentTerminalNoUnblock)\n\tErrDeploymentTerminalNoRun       = errors.New(errDeploymentTerminalNoRun)\n\tErrDeploymentTerminalNoSetHealth = errors.New(errDeploymentTerminalNoSetHealth)\n\tErrDeploymentRunningNoUnblock    = errors.New(errDeploymentRunningNoUnblock)\n\n\tErrCSIClientRPCIgnorable  = errors.New(\"CSI client error (ignorable)\")\n\tErrCSIClientRPCRetryable  = errors.New(\"CSI client error (retryable)\")\n\tErrCSIVolumeMaxClaims     = errors.New(\"volume max claims reached\")\n\tErrCSIVolumeUnschedulable = errors.New(\"volume is currently unschedulable\")\n\tErrCSIPluginInUse         = errors.New(\"plugin in use\")\n)\n\n// IsErrNoLeader returns whether the error is due to there being no leader.\nfunc IsErrNoLeader(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), errNoLeader)\n}\n\n// IsErrNoRegionPath returns whether the error is due to there being no path to\n// the given region.","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/errors.go#L65-L101","documentation":"Sentinel ErrDeploymentTerminalNoUnblock: UnblockDeployment was called on a deployment that already reached a terminal state; only deployments blocked awaiting unblocking (e.g. auto-revert decisions) can be unblocked.","triggerScenarios":"Calling Deployment.Unblock (or 'nomad deployment unblock') on a deployment that already reached a terminal state.","commonSituations":"Resuming deployments blocked on quota or evaluation after the deployment auto-failed or completed; scripts unblocking every deployment for a job.","solutions":["Check deployment status is active before unblocking.","Treat the error as a no-op for already-finished deployments.","If the deployment failed, create a new deployment via 'nomad job run' instead."],"exampleFix":"// before\nclient.Deployments().Unblock(deployID, nil)\n// after\nd, _ := client.Deployments().Info(deployID, nil)\nif d.Status == \"running\" { client.Deployments().Unblock(deployID, nil) }","handlingStrategy":"type-guard","validationCode":"d, err := client.Deployments().Info(deployID, nil)\nif err != nil { return err }\nif d.Status != \"running\" { return nil } // cannot unblock","typeGuard":"func deploymentActive(d *api.Deployment) bool {\n    return d.Status == \"running\" || d.Status == \"pending\"\n}","tryCatchPattern":"err := client.Deployments().Unblock(deployID, nil)\nif err != nil && strings.Contains(err.Error(), \"terminal deployment\") {\n    return nil // deployment resolved without unblocking\n}","preventionTips":["Unblock promptly when the underlying block reason (quota, capacity) is resolved.","Re-check status before batch unblock operations.","Alert on blocked deployments so they don't silently terminate."],"tags":["deployment","state","rpc","nomad"],"backgroundTag":"invalid-state-transition","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"}