{"record":{"id":"452b5d60fbbf85b0","repo":"Jguer/yay","slug":"entry-q-w","errorCode":null,"errorMessage":"entry %q: %w","messagePattern":"entry %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/settings/lua/lua.go","lineNumber":249,"sourceCode":"\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\n\t}\n\n\t// Sort by name so the resulting slice is deterministic despite Lua's\n\t// unordered table iteration.\n\tslices.SortFunc(entries, func(a, b namedElem) int {\n\t\treturn strings.Compare(a.name, b.name)\n\t})\n\n\tout := reflect.MakeSlice(field.Type(), len(entries), len(entries))\n\tfor i, entry := range entries {","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/pkg/settings/lua/lua.go#L231-L267","documentation":"A wrapper error: after an entry table passes the type check, `assignStructFields` populates the Go struct from the entry's keys, and any failure there is re-wrapped as `entry \"<name>\": <cause>` so the offending entry name is preserved in the chain.","triggerScenarios":"Any inner failure while decoding one named entry: non-string key inside the entry table, an unknown key not matching a `lua:\"...\"` struct tag, or a value whose type doesn't match the target struct field.","commonSituations":"Typos in field names inside a nested Lua option table, using numeric/array keys where named keys are required, or wrong value types (e.g. string where number expected) inside one entry of a multi-entry option.","solutions":["Read the wrapped cause after `entry %q:` to find the exact key that failed.","Fix the named entry table in the Lua config so all keys match the documented struct fields.","Validate one entry at a time by temporarily reducing the option table to a single entry."],"exampleFix":"-- before (typo)\ndebug = { lbel = true }\n-- after\ndebug = { label = true }","handlingStrategy":"try-catch","validationCode":"-- pre-check keys of one entry against allowed fields\nlocal allowed = { field = true, other = true }\nfor k in pairs(entry) do assert(allowed[k], \"unknown key \" .. k) end","typeGuard":null,"tryCatchPattern":"if err := loader.Load(cfg); err != nil {\n    var entryErr *fmt.WrapError // unwrap chain\n    // log err: message contains `entry \"<name>\": <cause>`\n    return fmt.Errorf(\"config invalid: %w\", err)\n}","preventionTips":["Copy field names from the tool's documented schema, not from memory","Test config changes with a single entry before adding many","Keep the error chain: read the cause after `entry \"name\":`"],"tags":["lua","config","error-wrapping","schema"],"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"}