{"record":{"id":"ec5b3a3aa100cdd4","repo":"Jguer/yay","slug":"entry-q-must-be-a-table-got-s","errorCode":null,"errorMessage":"entry %q must be a table, got %s","messagePattern":"entry %q must be a table, got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/settings/lua/lua.go","lineNumber":239,"sourceCode":"\tvar (\n\t\tentries  []namedElem\n\t\tfirstErr error\n\t)\n\n\ttbl.ForEach(func(k, entry lua.LValue) {\n\t\tif firstErr != nil {\n\t\t\treturn\n\t\t}\n\n\t\tname, ok := k.(lua.LString)\n\t\tif !ok {\n\t\t\tfirstErr = fmt.Errorf(\"entry keys must be strings, got %s\", k.Type())\n\t\t\treturn\n\t\t}\n\n\t\tentryTbl, ok := entry.(*lua.LTable)\n\t\tif !ok {\n\t\t\tfirstErr = fmt.Errorf(\"entry %q must be a table, got %s\", string(name), entry.Type())\n\t\t\treturn\n\t\t}\n\n\t\telem := reflect.New(elemType).Elem()\n\t\tif hasName {\n\t\t\telem.Field(nameIdx).SetString(string(name))\n\t\t}\n\n\t\tif err := assignStructFields(elem, entryTbl, fieldIndex); err != nil {\n\t\t\tfirstErr = fmt.Errorf(\"entry %q: %w\", string(name), err)\n\t\t\treturn\n\t\t}\n\n\t\tentries = append(entries, namedElem{name: string(name), elem: elem})\n\t})\n\n\tif firstErr != nil {\n\t\treturn firstErr","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/pkg/settings/lua/lua.go#L221-L257","documentation":"Thrown by the Lua settings loader when iterating an array-of-structs option table: each entry's value must itself be a Lua table, but it was another type (string, number, boolean, function, nil). The loader maps named entry tables onto Go struct fields via reflection, so a non-table entry cannot be assigned.","triggerScenarios":"A Lua config like `opt = { myname = \"value\" }` or `opt = { myname = 42 }` where the schema expects `opt = { myname = { field = ... } }`; the entry under key `name` is checked with `entry.(*lua.LTable)` and fails.","commonSituations":"Users migrating configs from flat key=value formats, copy-pasting snippets for a different option that accepts scalars, or forgetting the inner table braces around struct fields.","solutions":["Open the Lua config at the reported entry key and wrap the value in a table: `entry = { field = value }`.","Check the Go struct for that option (lua:\"...\" tags) to see which fields the entry table must contain.","If the value should be a list of plain strings, use a different option type rather than forcing it into the struct-slice option."],"exampleFix":"-- before\naliases = { ls = \"ls --color\" }\n-- after\naliases = { ls = { cmd = \"ls --color\" } }","handlingStrategy":"validation","validationCode":"-- validate before loading\nfor name, entry in pairs(opt) do\n  assert(type(entry) == \"table\", \"entry \" .. name .. \" must be a table, got \" .. type(entry))\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write struct options as `name = { field = value }` with braces","Check documented examples for each option before editing","Keep one entry per line so brace mistakes are visible"],"tags":["lua","config","type-error","schema"],"backgroundTag":"config-type-mismatch","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"}