Jguer/yay · error
result source must be a string
Error message
result source must be a string
What it means
Each result entry returned by a search-filter callback must be a table with a string 'source' field. If entry.RawGetString("source") is not an LString (missing key or non-string value), this error is recorded and later wrapped with the event name by the caller.
Solutions
- Add the 'source' key as a string to every returned entry, matching a valid source name exactly.
- Verify key spelling is exactly 'source' (lowercase, no abbreviations).
- When building entries dynamically, tostring() the source before assignment and skip entries without a valid source.
Example fix
-- before
return { { name = "symbols" } }
-- after
return { { source = "symbols", name = "symbols" } } Defensive patterns
Strategy: validation
Validate before calling
-- Lua: ensure each entry has a string source
for _, e in ipairs(out) do
if type(e.source) ~= "string" then error("entry missing string source") end
end Type guard
function has_string_source(e) return type(e) == "table" and type(e.source) == "string" end
Try / catch
if err != nil && strings.Contains(err.Error(), "result source must be a string") {
log.Print("a filter entry lacks a string 'source' key")
} Prevention
- Always set both 'source' and 'name' keys when constructing entries
- Use exact key names: 'source' and 'name', lowercase
- Derive entries from the active table instead of hand-building them
When it happens
Trigger: An entry table omits the 'source' key, sets it to nil, or uses a number/boolean value, e.g. { name = "symbols" } or { source = 1, name = "symbols" }.
Common situations: Users abbreviate the key ('src', 'type'), forget to set it when building entries programmatically, or copy the numeric index into source.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- each result must be a table
- result name must be a string
- unknown search result
- exclude must be a table
- exclude entries must be strings
AI-assisted analysis of Jguer/yay@328f4b4939 (2026-09-07).
Data as JSON: /api/errors/b289075a5bfb08ca.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/settings/lua/autocmd.go:642
parseErr error
)
seen := mapset.NewThreadUnsafeSet[SearchResultRef]()
tbl.ForEach(func(_ glua.LValue, val glua.LValue) {
if parseErr != nil {
return
}
entry, ok := val.(*glua.LTable)
if !ok {
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
}View on GitHub (pinned to 328f4b4939)