{"id":"2b2cac39a8d444b3","repo":"docker/cli","slug":"unknown-mode-s-only-replicated-and-global-suppo","errorCode":null,"errorMessage":"unknown mode: %s, only replicated and global supported","messagePattern":"unknown mode: (.+?), only replicated and global supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/service/opts.go","lineNumber":669,"sourceCode":"\t\t\tconcurrent = options.replicas.Value()\n\t\t}\n\t\tserviceMode.ReplicatedJob = &swarm.ReplicatedJob{\n\t\t\tMaxConcurrent:    concurrent,\n\t\t\tTotalCompletions: options.replicas.Value(),\n\t\t}\n\tcase \"global-job\":\n\t\tif options.maxReplicas > 0 {\n\t\t\treturn serviceMode, errors.New(\"replicas-max-per-node can only be used with replicated or replicated-job mode\")\n\t\t}\n\t\tif options.maxConcurrent.Value() != nil {\n\t\t\treturn serviceMode, errors.New(\"max-concurrent can only be used with replicated-job mode\")\n\t\t}\n\t\tif options.replicas.Value() != nil {\n\t\t\treturn serviceMode, errors.New(\"replicas can only be used with replicated or replicated-job mode\")\n\t\t}\n\t\tserviceMode.GlobalJob = &swarm.GlobalJob{}\n\tdefault:\n\t\treturn serviceMode, fmt.Errorf(\"unknown mode: %s, only replicated and global supported\", options.mode)\n\t}\n\treturn serviceMode, nil\n}\n\nfunc (options *serviceOptions) ToStopGracePeriod(flags *pflag.FlagSet) *time.Duration {\n\tif flags.Changed(flagStopGracePeriod) {\n\t\treturn options.stopGrace.Value()\n\t}\n\treturn nil\n}\n\n// makeEnv gets the environment variables from the command line options and\n// returns a slice of strings to use in the service spec when doing ToService\nfunc (options *serviceOptions) makeEnv() ([]string, error) {\n\tenvVariables, err := opts.ReadKVEnvStrings(options.envFile.GetSlice(), options.env.GetSlice())\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":651,"sourceCodeEnd":687,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/service/opts.go#L651-L687","documentation":"Error \"unknown mode: %s, only replicated and global supported\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/service/opts.go:669 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}