docker/cli ยท error

invalid count (%s): value must be either "all" or an integer

Error message

invalid count (%s): value must be either "all" or an integer: %w

What it means

Error "invalid count (%s): value must be either "all" or an integer: %w" thrown in docker/cli.

Source

Thrown at opts/gpus.go:28

	"github.com/moby/moby/api/types/container"
)

// GpuOpts is a Value type for parsing mounts
type GpuOpts struct {
	values []container.DeviceRequest
}

func parseCount(s string) (int, error) {
	if s == "all" {
		return -1, nil
	}
	i, err := strconv.Atoi(s)
	if err != nil {
		var numErr *strconv.NumError
		if errors.As(err, &numErr) {
			err = numErr.Err
		}
		return 0, fmt.Errorf(`invalid count (%s): value must be either "all" or an integer: %w`, s, err)
	}
	return i, nil
}

// Set a new mount value
//
//nolint:gocyclo
func (o *GpuOpts) Set(value string) error {
	csvReader := csv.NewReader(strings.NewReader(value))
	fields, err := csvReader.Read()
	if err != nil {
		return err
	}

	req := container.DeviceRequest{}

	seen := map[string]struct{}{}
	// Set writable as the default

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at opts/gpus.go:28 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/c906a1b9cfde2054.json. Report an issue: GitHub.