{"record":{"id":"736383b65df90bbe","repo":"Jguer/yay","slug":"s-w-736383","errorCode":null,"errorMessage":"%s: %w","messagePattern":"%s: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/settings/lua/lua.go","lineNumber":300,"sourceCode":"\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":282,"sourceCodeEnd":306,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/pkg/settings/lua/lua.go#L282-L306","documentation":"A wrapper error: once a key in a struct entry table resolves to a struct field, the value is converted by `assign`; any conversion failure is re-wrapped as `<key>: <cause>` to attribute the failure to the specific field.","triggerScenarios":"Value type mismatch for a known key, e.g. `debug = \"yes\"` where the Go field is bool, or a nested table where a scalar is expected; `assign` returns an error which is wrapped.","commonSituations":"Wrong value type for a known option (string vs boolean vs number), out-of-range numbers, or supplying a table to a scalar option.","solutions":["Look at the cause after the `key:` prefix; fix the value's type for that key.","Booleans must be `true`/`false` in Lua, not strings; numbers must be valid for the field's Go type.","Consult the option's Go field type in the settings struct to determine the accepted Lua type."],"exampleFix":"-- before\ndebug = \"true\"\n-- after\ndebug = true","handlingStrategy":"validation","validationCode":"-- coerce/verify value types before load\nassert(type(debug) == \"boolean\", \"debug must be boolean\")\nassert(type(level) == \"number\", \"level must be number\")","typeGuard":null,"tryCatchPattern":"if err := load(cfg); err != nil {\n    // message is `<key>: <cause>`; surface the key to the user\n    return fmt.Errorf(\"bad config value: %w\", err)\n}","preventionTips":["Use Lua booleans/numbers natively — never quote `\"true\"`","Match each option's value type to its documented Go field type","Validate the whole config with a small Lua pre-flight script"],"tags":["lua","config","type-error","error-wrapping"],"backgroundTag":"invalid-config-value","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"}