{"record":{"id":"bf6a85f187fbb8af","repo":"hashicorp/nomad","slug":"host-volume-s-is-in-nonexistent-namespace-s","errorCode":null,"errorMessage":"host volume %s is in nonexistent namespace %s","messagePattern":"host volume (.+?) is in nonexistent namespace (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store_host_volumes.go","lineNumber":62,"sourceCode":"\t\tfor _, volReq := range alloc.Job.LookupTaskGroup(alloc.TaskGroup).Volumes {\n\t\t\tif vol.MatchesRequestSource(volReq, alloc) {\n\t\t\t\tvol.Allocations = append(vol.Allocations, alloc.Stub(nil))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn vol, nil\n}\n\n// UpsertHostVolume upserts a host volume\nfunc (s *StateStore) UpsertHostVolume(index uint64, vol *structs.HostVolume) error {\n\ttxn := s.db.WriteTxnMsgT(structs.HostVolumeRegisterRequestType, index)\n\tdefer txn.Abort()\n\n\tif exists, err := s.namespaceExists(txn, vol.Namespace); err != nil {\n\t\treturn err\n\t} else if !exists {\n\t\treturn fmt.Errorf(\"host volume %s is in nonexistent namespace %s\", vol.ID, vol.Namespace)\n\t}\n\n\tobj, err := txn.First(TableHostVolumes, indexID, vol.Namespace, vol.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar old *structs.HostVolume\n\tif obj != nil {\n\t\told = obj.(*structs.HostVolume)\n\t\tvol.CreateIndex = old.CreateIndex\n\t\tvol.CreateTime = old.CreateTime\n\t} else {\n\t\tvol.CreateIndex = index\n\t}\n\n\terr = s.enforceHostVolumeQuotaTxn(txn, index, vol, old, true)\n\tif err != nil {\n\t\treturn err","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store_host_volumes.go#L44-L80","documentation":"UpsertHostVolume refused the write because the volume's namespace does not exist in the state store; host volumes can only be created in an existing namespace.","triggerScenarios":"Thrown at nomad/state/state_store_host_volumes.go:62 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the namespace first","Use an existing namespace for the volume","Check for typos in the volume's namespace field"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}