{"id":"5fe0ed38757de63a","repo":"docker/cli","slug":"format-is-incompatible-with-human-friendly-forma","errorCode":null,"errorMessage":"--format is incompatible with human friendly format","messagePattern":"--format is incompatible with human friendly format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/service/inspect.go","lineNumber":38,"sourceCode":"\ntype inspectOptions struct {\n\trefs   []string\n\tformat string\n\tpretty bool\n}\n\nfunc newInspectCommand(dockerCLI command.Cli) *cobra.Command {\n\tvar opts inspectOptions\n\n\tcmd := &cobra.Command{\n\t\tUse:   \"inspect [OPTIONS] SERVICE [SERVICE...]\",\n\t\tShort: \"Display detailed information on one or more services\",\n\t\tArgs:  cli.RequiresMinArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\topts.refs = args\n\n\t\t\tif opts.pretty && len(opts.format) > 0 {\n\t\t\t\treturn errors.New(\"--format is incompatible with human friendly format\")\n\t\t\t}\n\t\t\treturn runInspect(cmd.Context(), dockerCLI, opts)\n\t\t},\n\t\tValidArgsFunction:     completeServiceNames(dockerCLI),\n\t\tDisableFlagsInUseLine: true,\n\t}\n\n\tflags := cmd.Flags()\n\tflags.StringVarP(&opts.format, \"format\", \"f\", \"\", flagsHelper.InspectFormatHelp)\n\tflags.BoolVar(&opts.pretty, \"pretty\", false, \"Print the information in a human friendly format\")\n\n\treturn cmd\n}\n\nfunc runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {\n\tapiClient := dockerCLI.Client()\n\n\tif opts.pretty {","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/service/inspect.go#L20-L56","documentation":"Raised by `docker service inspect` when both --pretty and --format are supplied. --pretty forces the built-in human-friendly template and --format supplies a custom Go template; the two are mutually exclusive, so the command validates this in RunE before any API call.","triggerScenarios":"`docker service inspect --pretty --format '{{.ID}}' svc` or any invocation setting both flags; also aliases/wrappers that always add --pretty while the caller adds --format.","commonSituations":"Shell aliases or scripts that hardcode --pretty, users combining examples from different docs, or automation adding --format to a command a human wrote with --pretty.","solutions":["Drop one flag: use `--pretty` alone for human output, or `--format` alone for templated output.","If you want pretty via --format, use `--format pretty` instead of the boolean flag.","Check shell aliases/wrapper scripts for a hardcoded --pretty."],"exampleFix":"# before\ndocker service inspect --pretty --format '{{.ID}}' web\n# after\ndocker service inspect --format '{{.ID}}' web","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","swarm","services","cli-flags","formatting"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}