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 runInspect in cli/command/config/inspect.go when the --format value starts with "pretty" but is not exactly "pretty". The pretty formatter is a fixed built-in template for human-readable output; it cannot be combined with additional Go-template directives, so the CLI rejects the mixed format string instead of producing broken output.
Source
Thrown at cli/command/config/inspect.go:61
}
// runInspect inspects the given Swarm config.
func runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {
apiClient := dockerCLI.Client()
if opts.pretty {
opts.format = "pretty"
}
getRef := func(id string) (any, []byte, error) {
res, err := apiClient.ConfigInspect(ctx, id, client.ConfigInspectOptions{})
return res.Config, res.Raw, err
}
// check if the user is trying to apply a template to the pretty format, which
// is not supported
if strings.HasPrefix(opts.format, "pretty") && opts.format != "pretty" {
return errors.New("cannot supply extra formatting options to the pretty template")
}
configCtx := formatter.Context{
Output: dockerCLI.Out(),
Format: newFormat(opts.format, false),
}
if err := inspectFormatWrite(configCtx, opts.names, getRef); err != nil {
return cli.StatusError{StatusCode: 1, Status: err.Error()}
}
return nil
}
View on GitHub (pinned to e9452d6e78)
Solutions
- Use either `--pretty` (or `--format pretty`) alone for the human-readable view, or a pure Go template like `--format '{{.Spec.Name}}'` — never both.
- If you need specific fields, drop pretty and write the template for exactly those fields, optionally piped through `docker inspect -f` conventions.
- For machine-readable output use `--format json` and post-process with jq.
Example fix
# before
docker config inspect --format 'pretty {{.Spec.Name}}' app-config
# after (pick one)
docker config inspect --pretty app-config
docker config inspect --format '{{.Spec.Name}}' app-config When it happens
Trigger: Running `docker config inspect --format 'pretty{{.Spec.Name}}' myconfig` or any --format value that begins with the literal "pretty" followed by extra text; also combining --pretty with a custom --format that then gets normalized into such a string.
Common situations: Users assuming pretty is a modifier they can stack with a template ("pretty + just this field"); scripts concatenating format fragments where one fragment is 'pretty'; the same guard exists for secret/node inspect, so the confusion often carries over between commands.
Related errors
- error reading from STDIN: data is empty
- config file is required
- cannot supply extra formatting options to the pretty templat
- --format is incompatible with human friendly format
- cannot supply extra formatting options to the pretty templat
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/832b27018c5fb41f.json.
Report an issue: GitHub.