{"id":"304b417f8dad5b14","repo":"docker/cli","slug":"the-s-flag-requires-that-a-s-flag-and-or","errorCode":null,"errorMessage":"the --%s flag requires that a --%s flag and/or --%s flag be provided as well","messagePattern":"the --(.+?) flag requires that a --(.+?) flag and/or --(.+?) flag be provided as well","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/swarm/ca.go","lineNumber":82,"sourceCode":"\t}\n\n\tif !opts.rotate {\n\t\tfor _, f := range []string{flagCACert, flagCAKey, flagCertExpiry, flagExternalCA} {\n\t\t\tif flags.Changed(f) {\n\t\t\t\treturn fmt.Errorf(\"`--%s` flag requires the `--rotate` flag to update the CA\", f)\n\t\t\t}\n\t\t}\n\t\treturn displayTrustRoot(dockerCLI.Out(), res)\n\t}\n\n\tif flags.Changed(flagExternalCA) && len(opts.externalCA.Value()) > 0 && !flags.Changed(flagCACert) {\n\t\treturn fmt.Errorf(\n\t\t\t\"rotating to an external CA requires the `--%s` flag to specify the external CA's cert - \"+\n\t\t\t\t\"to add an external CA with the current root CA certificate, use the `update` command instead\", flagCACert)\n\t}\n\n\tif flags.Changed(flagCACert) && len(opts.externalCA.Value()) == 0 && !flags.Changed(flagCAKey) {\n\t\treturn fmt.Errorf(\"the --%s flag requires that a --%s flag and/or --%s flag be provided as well\",\n\t\t\tflagCACert, flagCAKey, flagExternalCA)\n\t}\n\n\tupdateSwarmSpec(&res.Swarm.Spec, flags, opts)\n\tif _, err := apiClient.SwarmUpdate(ctx, client.SwarmUpdateOptions{\n\t\tVersion: res.Swarm.Version,\n\t\tSpec:    res.Swarm.Spec,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tif opts.detach {\n\t\treturn nil\n\t}\n\treturn attach(ctx, dockerCLI, opts)\n}\n\nfunc updateSwarmSpec(spec *swarm.Spec, flags *pflag.FlagSet, opts caOptions) {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/swarm/ca.go#L64-L100","documentation":"Error \"the --%s flag requires that a --%s flag and/or --%s flag be provided as well\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/swarm/ca.go:82 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}