{"id":"a1f58cb680a513a6","repo":"docker/cli","slug":"invalid-rate-for-device-s-the-correct-format-is-a1f58c","errorCode":null,"errorMessage":"invalid rate for device: %s. The correct format is <device-path>:<number>. Number must be a positive integer","messagePattern":"invalid rate for device: (.+?)\\. The correct format is <device-path>:<number>\\. Number must be a positive integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"opts/throttledevice.go","lineNumber":51,"sourceCode":"\treturn &blkiodev.ThrottleDevice{\n\t\tPath: k,\n\t\tRate: uint64(rate),\n\t}, nil\n}\n\n// ValidateThrottleIOpsDevice validates that the specified string has a valid device-rate format.\nfunc ValidateThrottleIOpsDevice(val string) (*blkiodev.ThrottleDevice, error) {\n\tk, v, ok := strings.Cut(val, \":\")\n\tif !ok || k == \"\" {\n\t\treturn nil, fmt.Errorf(\"bad format: %s\", val)\n\t}\n\t// TODO(thaJeztah): should we really validate this on the client?\n\tif !strings.HasPrefix(k, \"/dev/\") {\n\t\treturn nil, fmt.Errorf(\"bad format for device path: %s\", val)\n\t}\n\trate, err := strconv.ParseUint(v, 10, 64)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid rate for device: %s. The correct format is <device-path>:<number>. Number must be a positive integer\", val)\n\t}\n\n\treturn &blkiodev.ThrottleDevice{Path: k, Rate: rate}, nil\n}\n\n// ThrottledeviceOpt defines a map of ThrottleDevices\ntype ThrottledeviceOpt struct {\n\tvalues    []*blkiodev.ThrottleDevice\n\tvalidator ValidatorThrottleFctType\n}\n\n// NewThrottledeviceOpt creates a new ThrottledeviceOpt\nfunc NewThrottledeviceOpt(validator ValidatorThrottleFctType) ThrottledeviceOpt {\n\treturn ThrottledeviceOpt{\n\t\tvalues:    []*blkiodev.ThrottleDevice{},\n\t\tvalidator: validator,\n\t}\n}","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/opts/throttledevice.go#L33-L69","documentation":"Error \"invalid rate for device: %s. The correct format is <device-path>:<number>. Number must be a positive integer\" thrown in docker/cli.","triggerScenarios":"Thrown at opts/throttledevice.go:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}