{"record":{"id":"0784bfd3eeb8e520","repo":"docker/compose","slug":"invalid-scale-specifier-s","errorCode":null,"errorMessage":"invalid scale specifier: %s","messagePattern":"invalid scale specifier: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/compose/scale.go","lineNumber":119,"sourceCode":"\treturn backend.Scale(ctx, project, api.ScaleOptions{Services: services})\n}\n\nfunc setServiceScale(project *types.Project, name string, replicas int) error {\n\tservice, err := project.GetService(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tservice.SetScale(replicas)\n\tproject.Services[name] = service\n\treturn nil\n}\n\nfunc parseServicesReplicasArgs(args []string) (map[string]int, error) {\n\tserviceReplicaTuples := map[string]int{}\n\tfor _, arg := range args {\n\t\tkey, val, ok := strings.Cut(arg, \"=\")\n\t\tif !ok || key == \"\" || val == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"invalid scale specifier: %s\", arg)\n\t\t}\n\t\tintValue, err := strconv.Atoi(val)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid scale specifier: can't parse replica value as int: %v\", arg)\n\t\t}\n\t\tserviceReplicaTuples[key] = intValue\n\t}\n\treturn serviceReplicaTuples, nil\n}\n","sourceCodeStart":101,"sourceCodeEnd":129,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/compose/scale.go#L101-L129","documentation":"Thrown by parseServicesReplicasArgs in the `docker compose scale` command when an argument cannot be split into a SERVICE=REPLICAS pair. The parser uses strings.Cut on '=' and requires a non-empty service name and a non-empty replica value, so any argument missing '=' or having an empty side is rejected before any project is loaded.","triggerScenarios":"Running `docker compose scale` with an argument like `web` (no '='), `=3` (empty service name), `web=` (empty replica value), or passing flags after args without '--'. cobra.MinimumNArgs(1) passes all args straight into the parser, and the first malformed one aborts the whole command.","commonSituations":"Muscle memory from `docker-compose scale web 3` (space-separated, old v1 syntax) instead of `web=3`; shell-quoting mistakes that swallow the '='; copy-pasting a service list where one entry is just a name; trailing empty arg from an unquoted variable like `scale ${SVC}=$REPLICAS` when REPLICAS is unset.","solutions":["Rewrite each argument as SERVICE=REPLICAS, e.g. `docker compose scale web=3 db=2`.","Check for stray empty arguments produced by unset shell variables (use `${VAR:?}` or quote the full pair).","If migrating from Compose v1, replace the old space-separated `scale svc count` form with the '=' form.","Run `docker compose scale --help` to confirm the expected [SERVICE=REPLICAS...] syntax."],"exampleFix":"# before\ndocker compose scale web 3\n\n# after\ndocker compose scale web=3","handlingStrategy":"validation","validationCode":"# before calling compose, verify each arg is SERVICE=INT\nfor arg in \"$@\"; do\n  [[ \"$arg\" =~ ^[A-Za-z0-9._-]+=.+$ ]] || { echo \"bad scale arg: $arg\" >&2; exit 2; }\ndone\ndocker compose scale \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always quote full SERVICE=REPLICAS pairs as one shell word.","Fail scripts early when computed args are empty (use ${VAR:?required}).","Remember Compose v2 syntax: one '=' per pair, unlike v1's space-separated form."],"tags":["cli","scale","argument-parsing","compose"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}