{"id":"d4524fd8a98dc334","repo":"docker/cli","slug":"failed-to-execute-template-w","errorCode":null,"errorMessage":"failed to execute template: %w","messagePattern":"failed to execute template: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/list.go","lineNumber":95,"sourceCode":"\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,\n\t\t\t// because calculating the size is a costly operation.\n\n\t\t\tif _, ok := optionsProcessor.FieldsUsed[\"Size\"]; ok {\n\t\t\t\tlistOptions.Size = true\n\t\t\t}\n\t\t}\n\t}\n","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/list.go#L77-L113","documentation":"Error \"failed to execute template: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/container/list.go:95 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}