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 secret inspect` when the --format value starts with "pretty" but is not exactly "pretty" (e.g. `--format 'pretty {{.ID}}'`). The pretty renderer is a fixed built-in human-readable template; it cannot be combined with additional Go-template directives, so the CLI rejects the mixed format up front.
Source
Thrown at cli/command/secret/inspect.go:59
return cmd
}
func runSecretInspect(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.SecretInspect(ctx, id, client.SecretInspectOptions{})
return res.Secret, 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")
}
secretCtx := formatter.Context{
Output: dockerCLI.Out(),
Format: newFormat(opts.format, false),
}
if err := inspectFormatWrite(secretCtx, opts.names, getRef); 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 human-readable output.
- For custom output, drop 'pretty' and supply a pure Go template: `--format '{{.Spec.Name}}: {{.ID}}'`.
- Get JSON with the default format and post-process with jq if you need selective fields.
Example fix
# before
docker secret inspect --format 'pretty {{.ID}}' mysecret
# after
docker secret inspect --format '{{.ID}}' mysecret # or: --pretty When it happens
Trigger: `docker secret inspect --format 'pretty{{...}}' name`, or any --format string with the literal prefix "pretty" followed by extra characters; also combining a configured pretty default with appended template text.
Common situations: Users trying to tweak the pretty output by appending template fields, copy-pasted commands that concatenate 'pretty' with a template, or scripts that build the format string and accidentally prepend 'pretty'.
Related errors
- --format is incompatible with human friendly format
- cannot supply extra formatting options to the pretty templat
- failed to parse hook template
- specify only one -H
- cannot supply extra formatting options to the pretty templat
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/1d6696bec77e3bbc.json.
Report an issue: GitHub.