{"record":{"id":"6b89cfa421a71a7d","repo":"Jguer/yay","slug":"result-name-must-be-a-string","errorCode":null,"errorMessage":"result name must be a string","messagePattern":"result name must be a string","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/settings/lua/autocmd.go","lineNumber":648,"sourceCode":"\t\tif parseErr != nil {\n\t\t\treturn\n\t\t}\n\n\t\tentry, ok := val.(*glua.LTable)\n\t\tif !ok {\n\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","sourceCodeStart":630,"sourceCodeEnd":666,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/pkg/settings/lua/autocmd.go#L630-L666","documentation":"Each result entry must also carry a string 'name' field. When entry.RawGetString(\"name\") is not an LString (absent or non-string), this error is stored in parseErr and propagated, wrapped with EventSearchFilter, to the caller.","triggerScenarios":"An entry table omits 'name', sets it to nil, or assigns a non-string value, e.g. { source = \"symbols\" } or { source = \"symbols\", name = 3 }.","commonSituations":"Users confuse the two keys (swapping name/source), omit name because they think source alone identifies the result, or build entries from data where the name field is numeric.","solutions":["Add a string 'name' key to every returned entry, matching a valid result name in the active set.","Check that source and name are not swapped in the entry table.","Coerce dynamic values with tostring() and validate before returning."],"exampleFix":"-- before\nreturn { { source = \"symbols\" } }\n-- after\nreturn { { source = \"symbols\", name = \"symbols\" } }","handlingStrategy":"validation","validationCode":"-- Lua: ensure each entry has a string name\nfor _, e in ipairs(out) do\n  if type(e.name) ~= \"string\" then error(\"entry missing string name\") end\nend","typeGuard":"function has_string_name(e) return type(e) == \"table\" and type(e.name) == \"string\" end","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"result name must be a string\") {\n    log.Print(\"a filter entry lacks a string 'name' key\")\n}","preventionTips":["Set both keys on every entry; source alone is not enough","Double-check source/name are not swapped","Coerce dynamic values with tostring() before assigning to 'name'"],"tags":["lua","search-filter","schema","validation"],"backgroundTag":"schema-validation-failed","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"}