docker/cli ยท error
cannot supply extra formatting options to the pretty templat
Error message
cannot supply extra formatting options to the pretty template
What it means
Raised by `docker service inspect` when the resolved format string starts with "pretty" but is not exactly "pretty". The pretty template is a fixed built-in and cannot take extra Go-template directives. Note the format may come not only from --format but also from the `serviceInspectFormat` setting in ~/.docker/config.json.
Source
Thrown at cli/command/service/inspect.go:88
res, err := apiClient.NetworkInspect(ctx, ref, client.NetworkInspectOptions{Scope: "swarm"})
if err == nil || !errdefs.IsNotFound(err) {
return res.Network, res.Raw, err
}
return nil, nil, fmt.Errorf("no such network: %s", ref)
}
f := opts.format
if len(f) == 0 {
f = "raw"
if len(dockerCLI.ConfigFile().ServiceInspectFormat) > 0 {
f = dockerCLI.ConfigFile().ServiceInspectFormat
}
}
// check if the user is trying to apply a template to the pretty format, which
// is not supported
if strings.HasPrefix(f, "pretty") && f != "pretty" {
return errors.New("cannot supply extra formatting options to the pretty template")
}
serviceCtx := formatter.Context{
Output: dockerCLI.Out(),
Format: newFormat(f),
}
if err := inspectFormatWrite(serviceCtx, opts.refs, getRef, getNetwork); err != nil {
return cli.StatusError{StatusCode: 1, Status: err.Error()}
}
return nil
}
View on GitHub (pinned to e9452d6e78)
Solutions
- Use exactly `--format pretty` or the --pretty flag.
- For custom fields, use a pure Go template without the 'pretty' prefix.
- If the error occurs without --format, fix or remove `serviceInspectFormat` in ~/.docker/config.json.
Example fix
// before (~/.docker/config.json)
{"serviceInspectFormat": "pretty {{.ID}}"}
// after
{"serviceInspectFormat": "pretty"} When it happens
Trigger: `docker service inspect --format 'pretty {{.ID}}' svc`, or a ~/.docker/config.json containing `"serviceInspectFormat": "pretty ..."` with trailing content, since that config value is used when --format is omitted.
Common situations: Users appending fields to the pretty template, or a malformed serviceInspectFormat entry in the docker client config causing every plain `docker service inspect` to fail unexpectedly.
Related errors
- --format is incompatible with human friendly format
- cannot supply extra formatting options to the pretty templat
- 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/f3035d87c04e6848.json.
Report an issue: GitHub.