docker/cli ยท error
--format is incompatible with human friendly format
Error message
--format is incompatible with human friendly format
What it means
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.
Source
Thrown at cli/command/service/inspect.go:38
type inspectOptions struct {
refs []string
format string
pretty bool
}
func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
var opts inspectOptions
cmd := &cobra.Command{
Use: "inspect [OPTIONS] SERVICE [SERVICE...]",
Short: "Display detailed information on one or more services",
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.refs = args
if opts.pretty && len(opts.format) > 0 {
return errors.New("--format is incompatible with human friendly format")
}
return runInspect(cmd.Context(), dockerCLI, opts)
},
ValidArgsFunction: completeServiceNames(dockerCLI),
DisableFlagsInUseLine: true,
}
flags := cmd.Flags()
flags.StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp)
flags.BoolVar(&opts.pretty, "pretty", false, "Print the information in a human friendly format")
return cmd
}
func runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {
apiClient := dockerCLI.Client()
if opts.pretty {View on GitHub (pinned to e9452d6e78)
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.
Example fix
# before
docker service inspect --pretty --format '{{.ID}}' web
# after
docker service inspect --format '{{.ID}}' web When it happens
Trigger: `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.
Common situations: 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.
Related errors
- cannot supply extra formatting options to the pretty templat
- placement preference must be of the format "<strategy>=<arg>
- cannot supply extra formatting options to the pretty templat
- got wrong object to inspect
- tty service logs only supported with --raw
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/5fe0ed38757de63a.json.
Report an issue: GitHub.