docker/cli ยท error

invalid rate for device: %s. The correct format is <device-p

Error message

invalid rate for device: %s. The correct format is <device-path>:<number>. Number must be a positive integer

What it means

Error "invalid rate for device: %s. The correct format is <device-path>:<number>. Number must be a positive integer" thrown in docker/cli.

Source

Thrown at opts/throttledevice.go:51

	return &blkiodev.ThrottleDevice{
		Path: k,
		Rate: uint64(rate),
	}, nil
}

// ValidateThrottleIOpsDevice validates that the specified string has a valid device-rate format.
func ValidateThrottleIOpsDevice(val string) (*blkiodev.ThrottleDevice, error) {
	k, v, ok := strings.Cut(val, ":")
	if !ok || k == "" {
		return nil, fmt.Errorf("bad format: %s", val)
	}
	// TODO(thaJeztah): should we really validate this on the client?
	if !strings.HasPrefix(k, "/dev/") {
		return nil, fmt.Errorf("bad format for device path: %s", val)
	}
	rate, err := strconv.ParseUint(v, 10, 64)
	if err != nil {
		return nil, fmt.Errorf("invalid rate for device: %s. The correct format is <device-path>:<number>. Number must be a positive integer", val)
	}

	return &blkiodev.ThrottleDevice{Path: k, Rate: rate}, nil
}

// ThrottledeviceOpt defines a map of ThrottleDevices
type ThrottledeviceOpt struct {
	values    []*blkiodev.ThrottleDevice
	validator ValidatorThrottleFctType
}

// NewThrottledeviceOpt creates a new ThrottledeviceOpt
func NewThrottledeviceOpt(validator ValidatorThrottleFctType) ThrottledeviceOpt {
	return ThrottledeviceOpt{
		values:    []*blkiodev.ThrottleDevice{},
		validator: validator,
	}
}

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at opts/throttledevice.go:51 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/a1f58cb680a513a6.json. Report an issue: GitHub.