{"id":"b09e708f3e540178","repo":"docker/cli","slug":"unsupported-placement-preference-s-only-spread-i","errorCode":null,"errorMessage":"unsupported placement preference %s (only spread is supported)","messagePattern":"unsupported placement preference (.+?) \\(only spread is supported\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/service/opts.go","lineNumber":104,"sourceCode":"}\n\nfunc (o *placementPrefOpts) String() string {\n\tif len(o.strings) == 0 {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%v\", o.strings)\n}\n\n// Set validates the input value and adds it to the internal slices.\n// Note: in the future strategies other than \"spread\", may be supported,\n// as well as additional comma-separated options.\nfunc (o *placementPrefOpts) Set(value string) error {\n\tstrategy, arg, ok := strings.Cut(value, \"=\")\n\tif !ok || strategy == \"\" {\n\t\treturn errors.New(`placement preference must be of the format \"<strategy>=<arg>\"`)\n\t}\n\tif strategy != \"spread\" {\n\t\treturn fmt.Errorf(\"unsupported placement preference %s (only spread is supported)\", strategy)\n\t}\n\n\to.prefs = append(o.prefs, swarm.PlacementPreference{\n\t\tSpread: &swarm.SpreadOver{\n\t\t\tSpreadDescriptor: arg,\n\t\t},\n\t})\n\to.strings = append(o.strings, value)\n\treturn nil\n}\n\n// Type returns a string name for this Option type\nfunc (*placementPrefOpts) Type() string {\n\treturn \"pref\"\n}\n\n// ShlexOpt is a flag Value which parses a string as a list of shell words\ntype ShlexOpt []string","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/service/opts.go#L86-L122","documentation":"Error \"unsupported placement preference %s (only spread is supported)\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/service/opts.go:104 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}