Jguer/yay · error

unknown search result

Error message

unknown search result %s/%s

What it means

After extracting source and name, the ref is checked against the 'valid' set of currently active search results. Returning a source/name pair that does not exist in the active result set is rejected with this error (formatted as source/name), which the caller then wraps with the event name.

Solutions

  1. Only return entries taken from the 'active' table passed into the callback rather than hard-coded names.
  2. Verify exact spelling of both source and name against the active result set.
  3. Log the active set inside the callback during development to confirm valid pairs.
  4. Update stale hard-coded names after upgrading or renaming sources/results.

Example fix

-- before
filter = function(active)
  return { { source = "buffers", name = "old-name" } }
end
-- after
filter = function(active)
  for _, r in ipairs(active) do
    if r.name == "new-name" then return { r } end
  end
  return nil
end
Defensive patterns

Strategy: validation

Validate before calling

-- Lua: only return entries that exist in the active set
local function in_active(active, e)
  for _, a in ipairs(active) do
    if a.source == e.source and a.name == e.name then return true end
  end
  return false
end

Type guard

function is_known_ref(active, e)
  for _, a in ipairs(active) do
    if a.source == e.source and a.name == e.name then return true end
  end
  return false
end

Try / catch

if err != nil && strings.Contains(err.Error(), "unknown search result") {
    log.Printf("filter referenced a non-active result: %v", err)
}

Prevention

When it happens

Trigger: The callback returns an entry whose source/name pair is misspelled, renamed, was filtered out earlier, or belongs to a source that is not active in this search invocation.

Common situations: Users hard-code result names in init.lua that no longer exist after a rename or config change; they return results from another session/context; they construct plausible names instead of echoing ones from the active table passed to the callback.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Jguer/yay@328f4b4939 (2026-09-07). Data as JSON: /api/errors/80a19f30940f5843. Report an issue: GitHub.

Appendix: source

Thrown at pkg/settings/lua/autocmd.go:654

			parseErr = fmt.Errorf("each result must be a table")
			return
		}

		source, ok := entry.RawGetString("source").(glua.LString)
		if !ok {
			parseErr = fmt.Errorf("result source must be a string")
			return
		}

		name, ok := entry.RawGetString("name").(glua.LString)
		if !ok {
			parseErr = fmt.Errorf("result name must be a string")
			return
		}

		ref := SearchResultRef{Source: string(source), Name: string(name)}
		if _, exists := valid[ref]; !exists {
			parseErr = fmt.Errorf("unknown search result %s/%s", ref.Source, ref.Name)
			return
		}

		if !seen.Add(ref) {
			return
		}

		refs = append(refs, ref)
	})

	if parseErr != nil {
		return nil, false, parseErr
	}

	return refs, true, nil
}

View on GitHub (pinned to 328f4b4939)