{"record":{"id":"80a19f30940f5843","repo":"Jguer/yay","slug":"unknown-search-result-s-s","errorCode":null,"errorMessage":"unknown search result %s/%s","messagePattern":"unknown search result (.+?)/(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/settings/lua/autocmd.go","lineNumber":654,"sourceCode":"\t\t\tparseErr = fmt.Errorf(\"each result must be a table\")\n\t\t\treturn\n\t\t}\n\n\t\tsource, ok := entry.RawGetString(\"source\").(glua.LString)\n\t\tif !ok {\n\t\t\tparseErr = fmt.Errorf(\"result source must be a string\")\n\t\t\treturn\n\t\t}\n\n\t\tname, ok := entry.RawGetString(\"name\").(glua.LString)\n\t\tif !ok {\n\t\t\tparseErr = fmt.Errorf(\"result name must be a string\")\n\t\t\treturn\n\t\t}\n\n\t\tref := SearchResultRef{Source: string(source), Name: string(name)}\n\t\tif _, exists := valid[ref]; !exists {\n\t\t\tparseErr = fmt.Errorf(\"unknown search result %s/%s\", ref.Source, ref.Name)\n\t\t\treturn\n\t\t}\n\n\t\tif !seen.Add(ref) {\n\t\t\treturn\n\t\t}\n\n\t\trefs = append(refs, ref)\n\t})\n\n\tif parseErr != nil {\n\t\treturn nil, false, parseErr\n\t}\n\n\treturn refs, true, nil\n}\n","sourceCodeStart":636,"sourceCodeEnd":671,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/pkg/settings/lua/autocmd.go#L636-L671","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Only return entries taken from the 'active' table passed into the callback rather than hard-coded names.","Verify exact spelling of both source and name against the active result set.","Log the active set inside the callback during development to confirm valid pairs.","Update stale hard-coded names after upgrading or renaming sources/results."],"exampleFix":"-- before\nfilter = function(active)\n  return { { source = \"buffers\", name = \"old-name\" } }\nend\n-- after\nfilter = function(active)\n  for _, r in ipairs(active) do\n    if r.name == \"new-name\" then return { r } end\n  end\n  return nil\nend","handlingStrategy":"validation","validationCode":"-- Lua: only return entries that exist in the active set\nlocal function in_active(active, e)\n  for _, a in ipairs(active) do\n    if a.source == e.source and a.name == e.name then return true end\n  end\n  return false\nend","typeGuard":"function is_known_ref(active, e)\n  for _, a in ipairs(active) do\n    if a.source == e.source and a.name == e.name then return true end\n  end\n  return false\nend","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unknown search result\") {\n    log.Printf(\"filter referenced a non-active result: %v\", err)\n}","preventionTips":["Never hard-code result names in init.lua; echo entries from the 'active' argument","Re-verify hard-coded names after any upgrade or config rename","Avoid returning duplicates — repeated refs are silently skipped but unknown ones error"],"tags":["lua","search-filter","validation","reference"],"backgroundTag":"resource-not-found","analyzedSha":"328f4b4939fb35f38c2f7c7ce3b8638a839bafa5","analyzedAt":"2026-09-07T16:45:12.608Z","contentChangedAt":"2026-09-07T16:45:12.608Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}