{"record":{"id":"5b4e43a5d9358805","repo":"junegunn/fzf","slug":"invalid-opt-margin","errorCode":null,"errorMessage":"invalid ${opt}: ${margin}","messagePattern":"invalid (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":2485,"sourceCode":"\t\tt, e := checked(margins[0])\n\t\tif e != nil {\n\t\t\treturn defaultMargin(), e\n\t\t}\n\t\tr, e := checked(margins[1])\n\t\tif e != nil {\n\t\t\treturn defaultMargin(), e\n\t\t}\n\t\tb, e := checked(margins[2])\n\t\tif e != nil {\n\t\t\treturn defaultMargin(), e\n\t\t}\n\t\tl, e := checked(margins[3])\n\t\tif e != nil {\n\t\t\treturn defaultMargin(), e\n\t\t}\n\t\treturn [4]sizeSpec{t, r, b, l}, nil\n\t}\n\treturn [4]sizeSpec{}, errors.New(\"invalid \" + opt + \": \" + margin)\n}\n\nfunc parseMarkerMultiLine(str string) (*[3]string, error) {\n\tif str == \"\" {\n\t\treturn &[3]string{}, nil\n\t}\n\tgr := uniseg.NewGraphemes(str)\n\tparts := []string{}\n\ttotalWidth := 0\n\tfor gr.Next() {\n\t\ts := string(gr.Runes())\n\t\ttotalWidth += uniseg.StringWidth(s)\n\t\tparts = append(parts, s)\n\t}\n\n\tresult := [3]string{}\n\tif totalWidth != 3 && totalWidth != 6 {\n\t\treturn &result, fmt.Errorf(\"invalid total marker width: %d (expected: 0, 3 or 6)\", totalWidth)","sourceCodeStart":2467,"sourceCodeEnd":2503,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L2467-L2503","documentation":"Thrown by parseMargin (used for --margin, --padding, --border-* padding forms) when the value has 4 comma-separated parts (TRBL form) but one of them fails the per-part check, or when the overall shape does not match the accepted 1/2/4-part forms and number ranges. The message interpolates the option name and the offending raw value.","triggerScenarios":"`--margin '1,2,3,4,5'` (five parts), `--margin '1,-2'` (negative), `--padding 'a,b'` (non-numeric), or a 3-part margin like '1,2,3' which is not a valid shape.","commonSituations":"Copy-pasting CSS-style shorthand (which allows 3 values) into fzf; script-built margin strings with an empty component from an unset variable; expecting '1 2 3 4' space-separated to work.","solutions":["Use 1, 2, or 4 comma-separated values only: 'M', 'V,H', 'T,R,B,L'","Ensure every component is a non-negative integer or percent (e.g. '5%')","Log/echo the generated margin string before invoking fzf to spot empty components"],"exampleFix":"# before\nfzf --margin '1,2,3'\n# after\nfzf --margin '1,2,3,4'","handlingStrategy":"validation","validationCode":"# bash: 1, 2, or 4 non-negative parts\nmargin_ok() {\n  IFS=',' read -ra p <<< \"$1\"\n  (( ${#p[@]} == 1 || ${#p[@]} == 2 || ${#p[@]} == 4 )) || return 1\n  for x in \"${p[@]}\"; do [[ \"$x\" =~ ^[0-9]+%?$ ]] || return 1; done\n}\nmargin_ok \"$MARGIN\" || MARGIN=\"0\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember fzf margins use CSS-like 1/2/4 shorthand but never 3 values","Echo composed margin strings during debugging to catch empty components"],"tags":["fzf","go","cli","margin","parsing"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}