{"record":{"id":"7ae6b6e3bd301174","repo":"hashicorp/nomad","slug":"can-t-unblock-running-deployment","errorCode":null,"errorMessage":"can't unblock running deployment","messagePattern":"can't unblock running deployment","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"nomad/structs/errors.go","lineNumber":86,"sourceCode":"\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.\nfunc IsErrNoRegionPath(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), errNoRegionPath)\n}","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/errors.go#L68-L104","documentation":"ErrDeploymentRunningNoUnblock is returned when an unblock request targets a deployment that is still running (not paused/blocked). Unblock only makes sense on a paused or blocked deployment; issuing it against an already-running deployment is rejected to avoid redundant or contradictory state transitions.","triggerScenarios":"Calling the Deployment.Unblock RPC (nomad deployment unblock) with the ID of a deployment whose state is already 'running' rather than 'paused' or 'blocked'.","commonSituations":"Operator runs 'nomad deployment unblock' on the wrong deployment ID or on a deployment that already auto-resumed; a script retries unblock after it already succeeded; failover automation unblocks a deployment the scheduler already unblocked.","solutions":["Check the deployment's Status/StatusDescription via 'nomad deployment status <id>' and only unblock if it is paused or blocked","Treat the error as a no-op in scripts (the desired state is already achieved)","Re-check whether the correct deployment ID was targeted; listing deployments for the job can reveal the paused one","Refresh local state after the first unblock so subsequent retries are skipped"],"exampleFix":"// before\nclient.Deployments().Unblock(depID, nil, nil)\n// after\ndep, _, _ := client.Deployments().Info(depID, nil)\nif dep != nil && dep.Status == structs.DeploymentStatusPaused {\n    client.Deployments().Unblock(depID, nil, nil)\n}","handlingStrategy":"try-catch","validationCode":"dep, _, err := client.Deployments().Info(depID, nil)\nif err == nil && dep != nil && dep.Status == api.DeploymentStatusRunning {\n    return nil // nothing to unblock\n}","typeGuard":"func deploymentNeedsUnblock(dep *api.Deployment) bool {\n    return dep != nil && dep.Status == api.DeploymentStatusPaused\n}","tryCatchPattern":"_, _, err := client.Deployments().Unblock(depID, nil, nil)\nif err != nil && strings.Contains(err.Error(), \"running deployment\") {\n    log.Printf(\"deployment %s already running; unblock not needed\", depID)\n    return nil\n}\nreturn err","preventionTips":["Check deployment status before issuing unblock","Make unblock scripts idempotent by treating this error as success","Target the correct deployment ID — list deployments per job first"],"tags":["nomad","deployment","state-conflict"],"backgroundTag":"deployment-already-terminal","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"}