{"record":{"id":"18b18c2dda57d728","repo":"hashicorp/nomad","slug":"device-d-is-nil","errorCode":null,"errorMessage":"device %d is nil","messagePattern":"device (.+?) is nil","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/device/device.go","lineNumber":103,"sourceCode":"}\n\n// Validate validates that the device group is valid\nfunc (d *DeviceGroup) Validate() error {\n\tvar mErr multierror.Error\n\n\tif d.Vendor == \"\" {\n\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"device vendor must be specified\"))\n\t}\n\tif d.Type == \"\" {\n\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"device type must be specified\"))\n\t}\n\tif d.Name == \"\" {\n\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"device name must be specified\"))\n\t}\n\n\tfor i, dev := range d.Devices {\n\t\tif dev == nil {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"device %d is nil\", i))\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := dev.Validate(); err != nil {\n\t\t\t_ = multierror.Append(&mErr, multierror.Prefix(err, fmt.Sprintf(\"device %d: \", i)))\n\t\t}\n\t}\n\n\tfor k, v := range d.Attributes {\n\t\tif err := v.Validate(); err != nil {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"device attribute %q invalid: %v\", k, err))\n\t\t}\n\t}\n\n\treturn mErr.ErrorOrNil()\n\n}\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/plugins/device/device.go#L85-L121","documentation":"DeviceGroup validation guard: a nil entry appears in the group's Devices list. Plugin-supplied fingerprint data contained a null device instance, which the loop detects and skips rather than dereferencing.","triggerScenarios":"Thrown at plugins/device/device.go:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the device plugin to omit nil entries from its device list","Filter null devices out of the fingerprint response before validation"],"exampleFix":null,"handlingStrategy":"type-guard","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"}