{"record":{"id":"982aa3cf01550aef","repo":"Jguer/yay","slug":"unknown-key-q","errorCode":null,"errorMessage":"unknown key %q","messagePattern":"unknown key %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/settings/lua/lua.go","lineNumber":295,"sourceCode":"// each key against the lua:\"...\" tags in index. Unknown keys are errors so\n// typos in nested option tables fail fast, mirroring top-level opt handling.\nfunc assignStructFields(sv reflect.Value, tbl *lua.LTable, index map[string]int) error {\n\tvar firstErr error\n\n\ttbl.ForEach(func(k, entry lua.LValue) {\n\t\tif firstErr != nil {\n\t\t\treturn\n\t\t}\n\n\t\tkey, ok := k.(lua.LString)\n\t\tif !ok {\n\t\t\tfirstErr = fmt.Errorf(\"keys must be strings, got %s\", k.Type())\n\t\t\treturn\n\t\t}\n\n\t\tfieldIdx, found := index[string(key)]\n\t\tif !found {\n\t\t\tfirstErr = fmt.Errorf(\"unknown key %q\", string(key))\n\t\t\treturn\n\t\t}\n\n\t\tif err := assign(sv.Field(fieldIdx), entry); err != nil {\n\t\t\tfirstErr = fmt.Errorf(\"%s: %w\", string(key), err)\n\t\t}\n\t})\n\n\treturn firstErr\n}\n","sourceCodeStart":277,"sourceCodeEnd":306,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/pkg/settings/lua/lua.go#L277-L306","documentation":"Thrown when a key in a struct-mapped Lua entry table does not match any `lua:\"...\"` struct tag in the target Go struct. The loader intentionally fails fast on unknown keys so typos in nested option tables are reported instead of silently ignored.","triggerScenarios":"A Lua config containing a misspelled or obsolete field inside an entry, e.g. `entry = { fiels = 1 }` where the struct defines `field`; `index[string(key)]` lookup misses.","commonSituations":"Upstream renames an option field and the user's config still uses the old name; copy-pasted config from a different tool; simple typos.","solutions":["Correct the key to the name reported in the `unknown key` message by checking the struct's lua tags or documentation.","Remove the key if it is no longer supported after a version upgrade.","Run the config through the loader after each upgrade to catch renamed fields early."],"exampleFix":"-- before (renamed option)\ndevel = { dbug = true }\n-- after\ndevel = { debug = true }","handlingStrategy":"validation","validationCode":"-- lint config keys against the documented schema\nlocal schema = { debug = true, verbose = true }\nfor k, _ in pairs(entry) do\n  if not schema[k] then error(\"unknown key \" .. tostring(k)) end\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After tool upgrades, re-check renamed option fields against the changelog","Use editor autocomplete or a config schema plugin if available","Start from the tool's example config instead of hand-writing keys"],"tags":["lua","config","typo","schema"],"backgroundTag":"missing-config-key","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"}