docker/cli ยท error

could not parse GenericResource: %s

Error message

could not parse GenericResource: %s

What it means

Error "could not parse GenericResource: %s" thrown in docker/cli.

Source

Thrown at cli/command/service/internal/genericresource/parse.go:20

//go:build go1.25

// Package genericresource is a local fork of SwarmKit's [genericresource] package,
// without protobuf dependencies.
//
// [genericresource]: https://github.com/moby/swarmkit/blob/v2.1.1/api/genericresource/parse.go
package genericresource

import (
	"encoding/csv"
	"fmt"
	"strconv"
	"strings"

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

func newParseError(format string, args ...any) error {
	return fmt.Errorf("could not parse GenericResource: "+format, args...)
}

// discreteResourceVal returns an int64 if the string is a discreteResource
// and an error if it isn't
func discreteResourceVal(res string) (int64, error) {
	return strconv.ParseInt(res, 10, 64)
}

// allNamedResources returns true if the array of resources are all namedResources
// e.g: res = [red, orange, green]
func allNamedResources(res []string) bool {
	for _, v := range res {
		if _, err := discreteResourceVal(v); err == nil {
			return false
		}
	}

	return true

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/service/internal/genericresource/parse.go:20 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/8b23a47bf925aba7.json. Report an issue: GitHub.