{"id":"8b23a47bf925aba7","repo":"docker/cli","slug":"could-not-parse-genericresource-s","errorCode":null,"errorMessage":"could not parse GenericResource: %s","messagePattern":"could not parse GenericResource: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/service/internal/genericresource/parse.go","lineNumber":20,"sourceCode":"//go:build go1.25\n\n// Package genericresource is a local fork of SwarmKit's [genericresource] package,\n// without protobuf dependencies.\n//\n// [genericresource]: https://github.com/moby/swarmkit/blob/v2.1.1/api/genericresource/parse.go\npackage genericresource\n\nimport (\n\t\"encoding/csv\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\tapi \"github.com/moby/moby/api/types/swarm\"\n)\n\nfunc newParseError(format string, args ...any) error {\n\treturn fmt.Errorf(\"could not parse GenericResource: \"+format, args...)\n}\n\n// discreteResourceVal returns an int64 if the string is a discreteResource\n// and an error if it isn't\nfunc discreteResourceVal(res string) (int64, error) {\n\treturn strconv.ParseInt(res, 10, 64)\n}\n\n// allNamedResources returns true if the array of resources are all namedResources\n// e.g: res = [red, orange, green]\nfunc allNamedResources(res []string) bool {\n\tfor _, v := range res {\n\t\tif _, err := discreteResourceVal(v); err == nil {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/service/internal/genericresource/parse.go#L2-L38","documentation":"Error \"could not parse GenericResource: %s\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/service/internal/genericresource/parse.go:20 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}