{"record":{"id":"4181a627de8db6ca","repo":"hashicorp/nomad","slug":"numa-device-q-not-requested-as-task-resource","errorCode":null,"errorMessage":"numa device %q not requested as task resource","messagePattern":"numa device %q not requested as task resource","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":2453,"sourceCode":"\t// Ensure the task isn't asking for disk resources\n\tif r.DiskMB > 0 {\n\t\tmErr.Errors = append(mErr.Errors, errors.New(\"Task can't ask for disk resources, they have to be specified at the task group level.\"))\n\t}\n\n\t// Ensure devices are valid\n\tdevices := set.New[string](len(r.Devices))\n\tfor i, d := range r.Devices {\n\t\tif err := d.Validate(); err != nil {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"device %d failed validation: %v\", i+1, err))\n\t\t}\n\t\tdevices.Insert(d.Name)\n\t}\n\n\t// Ensure each numa bound device matches a device requested for task\n\tif r.NUMA != nil {\n\t\tfor _, numaDevice := range r.NUMA.Devices {\n\t\t\tif !devices.Contains(numaDevice) {\n\t\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"numa device %q not requested as task resource\", numaDevice))\n\t\t\t}\n\t\t}\n\t}\n\n\t// Ensure the numa block is valid\n\tif err := r.NUMA.Validate(); err != nil {\n\t\tmErr.Errors = append(mErr.Errors, err)\n\t}\n\n\t// Ensure memory_max is greater than memory, unless it is set to 0 or -1 which\n\t// are both sentinel values\n\tif (r.MemoryMaxMB != 0 && r.MemoryMaxMB != MemoryNoLimit) && r.MemoryMaxMB < r.MemoryMB {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"MemoryMaxMB value (%d) should be larger than MemoryMB value (%d)\", r.MemoryMaxMB, r.MemoryMB))\n\t}\n\n\tif r.SecretsMB > r.MemoryMB {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"SecretsMB value (%d) cannot be larger than MemoryMB value (%d)\", r.SecretsMB, r.MemoryMB))\n\t}","sourceCodeStart":2435,"sourceCodeEnd":2471,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L2435-L2471","documentation":"Resources.Validate cross-checks the NUMA stanza against the requested devices: a numa affinity references a device name that does not appear in the task's resource device list, so the binding cannot be honored.","triggerScenarios":"Thrown at nomad/structs/structs.go:2453 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the named device to the task resources stanza","Fix the device name in the numa block to match a requested device"],"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"}