junegunn/fzf · warning

invalid total marker width: %d (expected: 0, 3 or 6)

Error message

invalid total marker width: %d (expected: 0, 3 or 6)

What it means

The multi-line marker string (parsed by parseMarkerMultiLine, used by marker options that need three equal-width segments) must have a total display width of exactly 3 (one cell per marker) or 6 (two cells each, e.g. emoji-wide graphemes). Any other total width is rejected. Width is measured per grapheme cluster, so combining characters and emoji count by their rendered width.

Source

Thrown at src/options.go:2503

	return [4]sizeSpec{}, errors.New("invalid " + opt + ": " + margin)
}

func parseMarkerMultiLine(str string) (*[3]string, error) {
	if str == "" {
		return &[3]string{}, nil
	}
	gr := uniseg.NewGraphemes(str)
	parts := []string{}
	totalWidth := 0
	for gr.Next() {
		s := string(gr.Runes())
		totalWidth += uniseg.StringWidth(s)
		parts = append(parts, s)
	}

	result := [3]string{}
	if totalWidth != 3 && totalWidth != 6 {
		return &result, fmt.Errorf("invalid total marker width: %d (expected: 0, 3 or 6)", totalWidth)
	}

	expected := totalWidth / 3
	idx := 0
	for _, part := range parts {
		expected -= uniseg.StringWidth(part)
		result[idx] += part
		if expected <= 0 {
			idx++
			expected = totalWidth / 3
		}
		if idx == 3 {
			break
		}
	}
	return &result, nil
}

View on GitHub (pinned to bd4efa277b)

Solutions

  1. Use exactly three single-width characters: --marker='>>>' (width 3)
  2. Or exactly three double-width graphemes (e.g. three emoji) for width 6
  3. Check widths programmatically if generating markers: each third must render to the same column count

Example fix

# before
fzf --marker='👉👉'   # width 4
# after
fzf --marker='>>>'    # width 3
# or
fzf --marker='👉👉👉'  # width 6
Defensive patterns

Strategy: validation

Validate before calling

# Go helper: accept only width-3 or width-6 markers before building args
func markerOK(s string) bool {
    w := uniseg.StringWidth(s)
    return s == "" || w == 3 || w == 6
}

Prevention

When it happens

Trigger: Passing a marker option (e.g. --marker) whose combined grapheme clusters total 0-as-nonempty, 1, 2, 4, 5, or more than 6 display columns; e.g. a single '> ' (width 2), four ASCII characters, or three double-width emoji plus one ASCII char.

Common situations: Customizing --marker with an emoji ('👉' is width 2, so three of them = 6 and works, but two of them = 4 fails); mixing a wide emoji with ASCII markers; older snippets assuming byte- or rune-based limits.

Related errors


AI-assisted analysis of junegunn/fzf@bd4efa277b (2026-08-15). Data as JSON: /api/errors/27fe6cb95ac21e50. Report an issue: GitHub.