{"record":{"id":"77f3f69f5950cbdc","repo":"hashicorp/nomad","slug":"volume-s-is-in-nonexistent-namespace-s","errorCode":null,"errorMessage":"volume %s is in nonexistent namespace %s","messagePattern":"volume (.+?) is in nonexistent namespace (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store.go","lineNumber":2656,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"job_summary lookup failed: %v\", err)\n\t}\n\n\tws.Add(iter.WatchCh())\n\n\treturn iter, nil\n}\n\n// UpsertCSIVolume inserts a volume in the state store.\nfunc (s *StateStore) UpsertCSIVolume(index uint64, volumes []*structs.CSIVolume) error {\n\ttxn := s.db.WriteTxnMsgT(structs.CSIVolumeRegisterRequestType, index)\n\tdefer txn.Abort()\n\n\tfor _, v := range volumes {\n\t\tif exists, err := s.namespaceExists(txn, v.Namespace); err != nil {\n\t\t\treturn err\n\t\t} else if !exists {\n\t\t\treturn fmt.Errorf(\"volume %s is in nonexistent namespace %s\", v.ID, v.Namespace)\n\t\t}\n\n\t\tobj, err := txn.First(TableCSIVolumes, \"id\", v.Namespace, v.ID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"volume existence check error: %v\", err)\n\t\t}\n\t\tif obj != nil {\n\t\t\t// Allow some properties of a volume to be updated in place, but\n\t\t\t// prevent accidentally overwriting important properties.\n\t\t\told := obj.(*structs.CSIVolume)\n\t\t\tif old.ExternalID != v.ExternalID ||\n\t\t\t\told.PluginID != v.PluginID ||\n\t\t\t\told.Provider != v.Provider {\n\t\t\t\treturn fmt.Errorf(\"volume identity cannot be updated: %s\", v.ID)\n\t\t\t}\n\t\t} else {\n\t\t\tv.CreateIndex = index\n\t\t}","sourceCodeStart":2638,"sourceCodeEnd":2674,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store.go#L2638-L2674","documentation":"During CSI volume registration, each volume's namespace is checked with namespaceExists. If the volume references a namespace that does not exist in the state store, registration is rejected with this error. It is a referential-integrity guard preventing volumes from being created in nonexistent namespaces.","triggerScenarios":"Calling CSIVolumeRegister (nomad volume register / CSI volume create) with a volume spec whose Namespace field names a namespace that hasn't been created.","commonSituations":"New Nomad setups where ACL namespaces were introduced but the target namespace was never created; copy-pasted HCL referencing the wrong or deleted namespace; default namespace assumptions after enabling namespaces.","solutions":["Create the namespace first: nomad namespace create <name> or via the Namespaces API","Verify the namespace field in the volume HCL matches an existing namespace (nomad namespace status)","If running without ACLs, ensure you're not implicitly targeting a non-default namespace"],"exampleFix":"// before: volume.hcl references missing namespace\nnamespace = \"team-a\"\n// after: create it first\n// $ nomad namespace create team-a\nnamespace = \"team-a\"","handlingStrategy":"validation","validationCode":"ns, _, err := client.Namespaces().Info(vol.Namespace, nil)\nif err != nil {\n  return fmt.Errorf(\"namespace %q does not exist: create it before registering volume\", vol.Namespace)\n}","typeGuard":null,"tryCatchPattern":"_, err := client.CSIVolumes().Register(vol, nil, nil)\nif err != nil && strings.Contains(err.Error(), \"nonexistent namespace\") {\n  client.Namespaces().Register(&api.Namespace{Name: vol.Namespace}, nil)\n  // then retry registration\n}","preventionTips":["Run `nomad namespace create <name>` before registering volumes in it","Keep volume HCL namespace in sync with your namespace manifest (IaC)","After enabling ACLs, verify namespaces exist in the target cluster"],"tags":["nomad","csi","namespace","volume"],"backgroundTag":"nonexistent-namespace","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"}