Jguer/yay · error

result name must be a string

Error message

result name must be a string

What it means

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.

Solutions

  1. Add a string 'name' key to every returned entry, matching a valid result name in the active set.
  2. Check that source and name are not swapped in the entry table.
  3. Coerce dynamic values with tostring() and validate before returning.

Example fix

-- before
return { { source = "symbols" } }
-- after
return { { source = "symbols", name = "symbols" } }
Defensive patterns

Strategy: validation

Validate before calling

-- Lua: ensure each entry has a string name
for _, e in ipairs(out) do
  if type(e.name) ~= "string" then error("entry missing string name") end
end

Type guard

function has_string_name(e) return type(e) == "table" and type(e.name) == "string" end

Try / catch

if err != nil && strings.Contains(err.Error(), "result name must be a string") {
    log.Print("a filter entry lacks a string 'name' key")
}

Prevention

When it happens

Trigger: An entry table omits 'name', sets it to nil, or assigns a non-string value, e.g. { source = "symbols" } or { source = "symbols", name = 3 }.

Common situations: 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.

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


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

Appendix: source

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

		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
		}

		refs = append(refs, ref)
	})

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

View on GitHub (pinned to 328f4b4939)