cli/cli · error

search returned mismatched keys and labels: %d keys, %d labe

Error message

search returned mismatched keys and labels: %d keys, %d labels

What it means

Error "search returned mismatched keys and labels: %d keys, %d labels" thrown in cli/cli.

Source

Thrown at internal/prompter/multi_select_with_search.go:135

	searchFunc := m.searchFunc
	return tea.Batch(
		func() tea.Msg {
			return msSearchResultMsg{query: query, result: searchFunc(query)}
		},
		m.spinner.Tick,
	)
}

// applySearchResult processes a completed search and rebuilds the option list.
func (m *multiSelectSearchField) applySearchResult(query string, result MultiSelectSearchResult) {
	m.loading = false
	m.lastQuery = query
	if result.Err != nil {
		m.err = result.Err
		return
	}
	if len(result.Keys) != len(result.Labels) {
		m.err = fmt.Errorf("search returned mismatched keys and labels: %d keys, %d labels", len(result.Keys), len(result.Labels))
		return
	}

	for i, k := range result.Keys {
		m.optionLabels[k] = result.Labels[i]
	}

	// Build option list: selected items first, then results, then persistent.
	var options []msOption
	seen := make(map[string]bool)

	// 1. Currently selected items.
	for _, k := range m.selectedKeys() {
		if seen[k] {
			continue
		}
		seen[k] = true
		options = append(options, msOption{label: m.label(k), value: k})

View on GitHub (pinned to 0eeec0b92e)

Solutions

  1. This is an internal gh defect; upgrade gh to the latest version and report the issue if it persists.

When it happens

Trigger: Thrown at internal/prompter/multi_select_with_search.go:135 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of cli/cli@0eeec0b92e (2026-08-15). Data as JSON: /api/errors/65488767c2ce7cfc. Report an issue: GitHub.