{"record":{"id":"faa7ec343e124403","repo":"hashicorp/nomad","slug":"deployment-id-q-matched-no-deployments","errorCode":null,"errorMessage":"Deployment ID %q matched no deployments","messagePattern":"Deployment ID %q matched no deployments","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/deployment_status.go","lineNumber":550,"sourceCode":"\tdID = strings.ReplaceAll(dID, \"-\", \"\")\n\tif len(dID) == 1 {\n\t\treturn nil, nil, fmt.Errorf(\"Identifier must contain at least two characters.\")\n\t}\n\tif len(dID)%2 == 1 {\n\t\t// Identifiers must be of even length, so we strip off the last byte\n\t\t// to provide a consistent user experience.\n\t\tdID = dID[:len(dID)-1]\n\t}\n\n\t// Have to do a prefix lookup\n\tdeploys, _, err := client.PrefixList(dID)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tswitch len(deploys) {\n\tcase 0:\n\t\treturn nil, nil, fmt.Errorf(\"Deployment ID %q matched no deployments\", dID)\n\tcase 1:\n\t\treturn deploys[0], nil, nil\n\tdefault:\n\t\treturn nil, deploys, nil\n\t}\n}\n\nfunc formatDeployment(c *api.Client, d *api.Deployment, uuidLength int) string {\n\tif d == nil {\n\t\treturn \"No deployment found\"\n\t}\n\t// Format the high-level elements\n\thigh := []string{\n\t\tfmt.Sprintf(\"ID|%s\", limit(d.ID, uuidLength)),\n\t\tfmt.Sprintf(\"Job ID|%s\", d.JobID),\n\t\tfmt.Sprintf(\"Job Version|%d\", d.JobVersion),\n\t\tfmt.Sprintf(\"Status|%s\", d.Status),\n\t\tfmt.Sprintf(\"Description|%s\", d.StatusDescription),","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/deployment_status.go#L532-L568","documentation":"getDeployment lists deployments matching the given ID prefix; when the prefix is syntactically valid but no deployment matches, it returns \"Deployment ID %q matched no deployments\". This is a prefix-match miss, not an API failure.","triggerScenarios":"Calling getDeployment with a valid-length UUID prefix that doesn't correspond to any deployment in the cluster (typo, wrong cluster/namespace, deployment already GC'd).","commonSituations":"Stale IDs copied from old terminal output; pointing NOMAD_ADDR at a different cluster; deployments purged by job GC so the ID no longer resolves.","solutions":["Run `nomad deployment list` and copy an existing deployment ID","Verify NOMAD_ADDR/NOMAD_NAMESPACE point at the right cluster/namespace","Use the full UUID to avoid prefix ambiguity or truncation issues"],"exampleFix":"// before\nnomad deployment status e3f1c2a9  # guessed/old prefix\n// after\nnomad deployment list\nnomad deployment status <full-id-from-list>","handlingStrategy":"validation","validationCode":"ids, _, err := client.Deployments().List(&api.QueryOptions{})\n// confirm the prefix matches an entry before calling the status command\nfound := false\nfor _, d := range ids {\n    if strings.HasPrefix(d.ID, prefix) { found = true; break }\n}\nif !found { return fmt.Errorf(\"unknown deployment prefix %q\", prefix) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy IDs directly from `nomad deployment list` output","Check NOMAD_ADDR/NOMAD_NAMESPACE/region before querying","Remember GC removes old deployments — don't cache IDs long-term"],"tags":["cli","not-found","identifier"],"backgroundTag":"resource-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"}