{"record":{"id":"17b611700e1242af","repo":"jesseduffield/lazygit","slug":"unable-to-parse-label-format-error-err","errorCode":null,"errorMessage":"unable to parse label format, error: {{err}}","messagePattern":"unable to parse label format, error: (.+?)\\}","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/services/custom_commands/menu_generator.go","lineNumber":76,"sourceCode":"\t}\n\n\tregex, err := regexp.Compile(filter)\n\tif err != nil {\n\t\treturn nil, errors.New(\"unable to parse filter regex, error: \" + err.Error())\n\t}\n\n\tvalueTemplateAux, err := template.New(\"format\").Parse(valueFormat)\n\tif err != nil {\n\t\treturn nil, errors.New(\"unable to parse value format, error: \" + err.Error())\n\t}\n\tvalueTemplate := NewTrimmerTemplate(valueTemplateAux)\n\n\tvar labelTemplate *TrimmerTemplate\n\tif labelFormat != \"\" {\n\t\tcolorFuncMap := style.TemplateFuncMapAddColors(template.FuncMap{})\n\t\tlabelTemplateAux, err := template.New(\"format\").Funcs(colorFuncMap).Parse(labelFormat)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"unable to parse label format, error: \" + err.Error())\n\t\t}\n\t\tlabelTemplate = NewTrimmerTemplate(labelTemplateAux)\n\t} else {\n\t\tlabelTemplate = valueTemplate\n\t}\n\n\treturn func(line string) (*commandMenuItem, error) {\n\t\treturn self.generateMenuItem(\n\t\t\tline,\n\t\t\tregex,\n\t\t\tvalueTemplate,\n\t\t\tlabelTemplate,\n\t\t)\n\t}, nil\n}\n\nfunc (self *MenuGenerator) generateMenuItem(\n\tline string,","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/services/custom_commands/menu_generator.go#L58-L94","documentation":"When a menuFromCommand prompt specifies a `labelFormat`, MenuGenerator parses it as a Go text/template with color functions added. If parsing fails, this error wraps the underlying template syntax error. labelFormat is optional; when absent the valueTemplate is reused, so only an explicitly set bad labelFormat triggers this.","triggerScenarios":"A labelFormat with malformed template syntax: unclosed '{{', invalid action, or a pipe to a nonexistent function (only the color FuncMap from style.TemplateFuncMapAddColors plus builtins are available).","commonSituations":"Adding coloring like '{{.group_1 | green}}' with a typo in the function name, or broken braces while hand-editing config.yml.","solutions":["Fix the labelFormat template syntax (balanced '{{ }}', valid function names).","Verify any piped function exists: built-ins plus the color helpers (e.g. green, yellow, bold) registered by style.TemplateFuncMapAddColors.","If labels can equal values, remove labelFormat entirely to fall back to valueFormat."],"exampleFix":"# before\n    labelFormat: '{{.group_1 | grean}}'\n# after\n    labelFormat: '{{.group_1 | green}}'","handlingStrategy":"validation","validationCode":"if prompt.LabelFormat != \"\" {\n    if _, err := template.New(\"format\").Funcs(style.TemplateFuncMapAddColors(template.FuncMap{})).Parse(prompt.LabelFormat); err != nil {\n        return fmt.Errorf(\"bad labelFormat: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use color functions that exist in style.TemplateFuncMapAddColors (green, red, yellow, bold, ...).","Omit labelFormat when labels can equal values — fewer templates to break.","Validate templates in a config-lint step before deploying config changes."],"tags":["config","template","custom-commands","menu"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}