{"record":{"id":"d6fe58ed0cbacc01","repo":"jesseduffield/lazygit","slug":"unable-to-parse-value-format-error-err","errorCode":null,"errorMessage":"unable to parse value format, error: {{err}}","messagePattern":"unable to parse value format, error: (.+?)\\}","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/services/custom_commands/menu_generator.go","lineNumber":67,"sourceCode":"\treturn menuItems, nil\n}\n\nfunc (self *MenuGenerator) getMenuItemFromLinefn(filter string, valueFormat string, labelFormat string) (func(line string) (*commandMenuItem, error), error) {\n\tif filter == \"\" && valueFormat == \"\" && labelFormat == \"\" {\n\t\t// showing command output lines as-is in suggestions panel\n\t\treturn func(line string) (*commandMenuItem, error) {\n\t\t\treturn &commandMenuItem{label: line, value: line}, nil\n\t\t}, nil\n\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,","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/services/custom_commands/menu_generator.go#L49-L85","documentation":"MenuGenerator.getMenuItemFromLinefn parses the `valueFormat` field of a menuFromCommand prompt as a Go text/template. If template.New(\"format\").Parse(valueFormat) fails (malformed template syntax), this error wraps the parse failure. valueFormat turns each captured regex group into the menu item's value.","triggerScenarios":"A valueFormat with unbalanced '{{' / '}}', unknown function names, or invalid template syntax such as '{{ .group_1 ' (missing closing braces) or '{{if}}' without end.","commonSituations":"Typing a template placeholder wrong in config.yml; forgetting the closing '}}' when editing '{{.group_1}}'; using a function not in the template FuncMap.","solutions":["Correct the valueFormat template so every '{{' has a matching '}}' and actions are valid, e.g. '{{.group_1}}'.","Check the adjacent labelFormat too — it is parsed right after and fails similarly.","Reload config and rerun the custom command."],"exampleFix":"# before\n    valueFormat: '{{.group_1'   # missing }}\n# after\n    valueFormat: '{{.group_1}}'","handlingStrategy":"validation","validationCode":"if _, err := template.New(\"format\").Parse(prompt.ValueFormat); err != nil {\n    return fmt.Errorf(\"bad valueFormat for prompt %q: %w\", prompt.Title, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compile-check all templates (valueFormat and labelFormat) whenever you edit them.","Keep templates minimal: '{{.group_1}}' style placeholders only.","Remember valueFormat is always parsed (even when empty) — an empty string parses fine, so errors mean real syntax damage."],"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"}