{"id":"dc68b18a2c520b7e","repo":"docker/cli","slug":"failed-to-parse-template-w","errorCode":null,"errorMessage":"failed to parse template: %w","messagePattern":"failed to parse template: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/list.go","lineNumber":87,"sourceCode":"}\n\nfunc buildContainerListOptions(options *psOptions) (client.ContainerListOptions, error) {\n\tlistOptions := client.ContainerListOptions{\n\t\tAll:     options.all,\n\t\tLimit:   options.last,\n\t\tSize:    options.size,\n\t\tFilters: options.filter.Value(),\n\t}\n\n\tif options.nLatest && options.last == -1 {\n\t\tlistOptions.Limit = 1\n\t}\n\n\t// always validate template when `--format` is used, for consistency\n\tif len(options.format) > 0 {\n\t\ttmpl, err := templates.Parse(options.format)\n\t\tif err != nil {\n\t\t\treturn client.ContainerListOptions{}, fmt.Errorf(\"failed to parse template: %w\", err)\n\t\t}\n\n\t\toptionsProcessor := formatter.NewContainerContext()\n\n\t\t// This shouldn't error out but swallowing the error makes it harder\n\t\t// to track down if preProcessor issues come up.\n\t\tif err := tmpl.Execute(io.Discard, optionsProcessor); err != nil {\n\t\t\treturn client.ContainerListOptions{}, fmt.Errorf(\"failed to execute template: %w\", err)\n\t\t}\n\n\t\t// if `size` was not explicitly set to false (with `--size=false`)\n\t\t// and `--quiet` is not set, request size if the template requires it\n\t\tif !options.quiet && !listOptions.Size && !options.sizeChanged {\n\t\t\t// The --size option isn't set, but .Size may be used in the template.\n\t\t\t// Parse and execute the given template to detect if the .Size field is\n\t\t\t// used. If it is, then automatically enable the --size option. See #24696\n\t\t\t//\n\t\t\t// Only requesting container size information when needed is an optimization,","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/list.go#L69-L105","documentation":"Error \"failed to parse template: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/container/list.go:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}