{"id":"5d2c8929989e9f16","repo":"docker/cli","slug":"invalid-generic-resource-specification-w","errorCode":null,"errorMessage":"invalid generic resource specification: %w","messagePattern":"invalid generic resource specification: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/service/generic_resource_opts.go","lineNumber":37,"sourceCode":"func ValidateSingleGenericResource(val string) (string, error) {\n\tif strings.Count(val, \"=\") < 1 {\n\t\treturn \"\", fmt.Errorf(\"invalid generic-resource format `%s` expected `name=value`\", val)\n\t}\n\n\treturn val, nil\n}\n\n// ParseGenericResources parses an array of Generic resourceResources\n// Requesting Named Generic Resources for a service is not supported this\n// is filtered here.\nfunc ParseGenericResources(value []string) ([]swarm.GenericResource, error) {\n\tif len(value) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tswarmResources, err := genericresource.Parse(value)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid generic resource specification: %w\", err)\n\t}\n\n\tfor _, res := range swarmResources {\n\t\tif res.NamedResourceSpec != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid generic-resource request `%s=%s`, Named Generic Resources is not supported for service create or update\",\n\t\t\t\tres.NamedResourceSpec.Kind, res.NamedResourceSpec.Value,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn swarmResources, nil\n}\n\nfunc buildGenericResourceMap(genericRes []swarm.GenericResource) (map[string]swarm.GenericResource, error) {\n\tm := make(map[string]swarm.GenericResource)\n\n\tfor _, res := range genericRes {\n\t\tif res.DiscreteResourceSpec == nil {","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/service/generic_resource_opts.go#L19-L55","documentation":"Error \"invalid generic resource specification: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/service/generic_resource_opts.go:37 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}