{"record":{"id":"e6d1417d4dfd9693","repo":"kubernetes/kops","slug":"devicename-not-set-for-volume","errorCode":null,"errorMessage":"DeviceName not set for volume","messagePattern":"DeviceName not set for volume","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/helper.go","lineNumber":53,"sourceCode":"\t}\n\n\tblockDeviceMappings := make(map[string]*BlockDeviceMapping)\n\n\tfor _, ed := range mt.EphemeralDevices() {\n\t\tblockDeviceMappings[ed.DeviceName] = &BlockDeviceMapping{VirtualName: new(ed.VirtualName)}\n\t}\n\n\treturn blockDeviceMappings, nil\n}\n\n// buildAdditionalDevices is responsible for creating additional volumes in this lc\nfunc buildAdditionalDevices(volumes []*BlockDeviceMapping) (map[string]*BlockDeviceMapping, error) {\n\tdevices := make(map[string]*BlockDeviceMapping)\n\n\t// @step: iterate the volumes and create devices from them\n\tfor _, x := range volumes {\n\t\tif x.DeviceName == nil {\n\t\t\treturn nil, errors.New(\"DeviceName not set for volume\")\n\t\t}\n\t\tdevices[*x.DeviceName] = x\n\t}\n\n\treturn devices, nil\n}\n","sourceCodeStart":35,"sourceCodeEnd":60,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/helper.go#L35-L60","documentation":"buildAdditionalDevices converts a task's list of BlockDeviceMapping into a device-name-keyed map for AWS LaunchConfiguration/LaunchTemplate rendering. Every volume must have an explicit DeviceName; if one is nil the function aborts rather than guessing a name, since AWS maps block devices by device path.","triggerScenarios":"Rendering an InstanceGroup (via RenderAWS or RenderTerraform) whose BlockDeviceMappings include a volume with no deviceName set in the cluster spec — e.g. a blockDeviceMapping entry with only volumeSize/volumeType but no deviceName field.","commonSituations":"A cluster spec where rootVolumeSize was replaced with a custom blockDeviceMapping entry but deviceName was omitted (AWS usually expects /dev/xvda or /dev/nvme0n1); copying task manifests between cloud providers where the field is named differently; hand-edited manifests.","solutions":["Set deviceName on each blockDeviceMapping entry in the InstanceGroup spec (e.g. deviceName: /dev/xvda)","Run kops edit instancegroup <group> and add the missing deviceName, then kops update cluster","If the device is the root volume, set it in rootVolume* fields instead of blockDeviceMappings"],"exampleFix":"// before\nblockDeviceMappings:\n- volumeSize: 100\n  volumeType: gp2\n// after\nblockDeviceMappings:\n- deviceName: /dev/xvda\n  volumeSize: 100\n  volumeType: gp2","handlingStrategy":"validation","validationCode":"for i, bdm := range spec.BlockDeviceMappings {\n\tif bdm.DeviceName == \"\" { return fmt.Errorf(\"blockDeviceMappings[%d]: deviceName is required\", i) }\n}","typeGuard":null,"tryCatchPattern":"if _, err := buildAdditionalDevices(volumes); err != nil {\n\treturn fmt.Errorf(\"invalid blockDeviceMappings: %w\", err)\n}","preventionTips":["Always set deviceName on every blockDeviceMapping in AWS instance groups","Validate the cluster spec with kops get/fmt before update","Keep root volume config in rootVolume* fields rather than custom mappings"],"tags":["aws","block-devices","configuration","launch-configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}