{"record":{"id":"c13bbe7430cb74f8","repo":"hashicorp/nomad","slug":"missing-name","errorCode":null,"errorMessage":"missing name","messagePattern":"missing name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/host_volumes.go","lineNumber":142,"sourceCode":"\t\tCreateIndex:   hv.CreateIndex,\n\t\tCreateTime:    hv.CreateTime,\n\t\tModifyIndex:   hv.ModifyIndex,\n\t\tModifyTime:    hv.ModifyTime,\n\t}, nil\n}\n\n// Validate verifies that the submitted HostVolume spec has valid field values,\n// without validating any changes or state (see ValidateUpdate).\nfunc (hv *HostVolume) Validate() error {\n\n\tvar mErr *multierror.Error\n\n\tif hv.ID != \"\" && !helper.IsUUID(hv.ID) {\n\t\tmErr = multierror.Append(mErr, fmt.Errorf(\"invalid ID %q\", hv.ID))\n\t}\n\n\tif hv.Name == \"\" {\n\t\tmErr = multierror.Append(mErr, errors.New(\"missing name\"))\n\t}\n\n\tif hv.RequestedCapacityMaxBytes < hv.RequestedCapacityMinBytes {\n\t\tmErr = multierror.Append(mErr, fmt.Errorf(\n\t\t\t\"capacity_max (%d) must be larger than capacity_min (%d)\",\n\t\t\thv.RequestedCapacityMaxBytes, hv.RequestedCapacityMinBytes))\n\t}\n\n\tfor _, cap := range hv.RequestedCapabilities {\n\t\terr := cap.Validate()\n\t\tif err != nil {\n\t\t\tmErr = multierror.Append(mErr, err)\n\t\t}\n\t}\n\n\tfor _, constraint := range hv.Constraints {\n\t\tif err := constraint.Validate(); err != nil {\n\t\t\tmErr = multierror.Append(mErr, fmt.Errorf(\"invalid constraint: %v\", err))","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/host_volumes.go#L124-L160","documentation":"HostVolume.Validate requires a non-empty Name for a host volume. A HostVolume with no name fails validation with the sentinel 'missing name', appended to the multierror after the ID check. This ensures volumes are addressable in the state store and API.","triggerScenarios":"Registering or validating a HostVolume struct (via the host volumes API / validateVolumeUpdate path) where hv.Name == \"\".","commonSituations":"Programmatic volume construction forgetting the Name field; partial updates building an empty HostVolume for validation; deserializing a volume spec with a missing or misspelled name key.","solutions":["Set the host volume's name field to a non-empty value","If registering via API/CLI, include the volume name in the request payload","Verify JSON/HCL decoding maps the name field correctly (correct key casing)","Use validation before submission to catch the missing name client-side"],"exampleFix":"// before\nhv := &structs.HostVolume{\n  ID:   \"e5f0b1c2-...\",\n}\n\n// after\nhv := &structs.HostVolume{\n  ID:   \"e5f0b1c2-...\",\n  Name: \"shared-data\",\n}","handlingStrategy":"validation","validationCode":"if hv.Name == \"\" {\n\treturn errors.New(\"host volume must have a name\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require name in volume provisioning tooling","Schema-validate volume JSON before API submission","Initialize all mandatory HostVolume fields at construction"],"tags":["nomad","host-volume","validation","required-field"],"backgroundTag":"missing-required-argument","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"}