docker/cli ยท error
failed to parse template: %w
Error message
failed to parse template: %w
What it means
Error "failed to parse template: %w" thrown in docker/cli.
Source
Thrown at cli/command/container/list.go:87
}
func buildContainerListOptions(options *psOptions) (client.ContainerListOptions, error) {
listOptions := client.ContainerListOptions{
All: options.all,
Limit: options.last,
Size: options.size,
Filters: options.filter.Value(),
}
if options.nLatest && options.last == -1 {
listOptions.Limit = 1
}
// always validate template when `--format` is used, for consistency
if len(options.format) > 0 {
tmpl, err := templates.Parse(options.format)
if err != nil {
return client.ContainerListOptions{}, fmt.Errorf("failed to parse template: %w", err)
}
optionsProcessor := formatter.NewContainerContext()
// This shouldn't error out but swallowing the error makes it harder
// to track down if preProcessor issues come up.
if err := tmpl.Execute(io.Discard, optionsProcessor); err != nil {
return client.ContainerListOptions{}, fmt.Errorf("failed to execute template: %w", err)
}
// if `size` was not explicitly set to false (with `--size=false`)
// and `--quiet` is not set, request size if the template requires it
if !options.quiet && !listOptions.Size && !options.sizeChanged {
// The --size option isn't set, but .Size may be used in the template.
// Parse and execute the given template to detect if the .Size field is
// used. If it is, then automatically enable the --size option. See #24696
//
// Only requesting container size information when needed is an optimization,View on GitHub (pinned to e9452d6e78)
When it happens
Trigger: Thrown at cli/command/container/list.go:87 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/dc68b18a2c520b7e.json.
Report an issue: GitHub.