Jguer/yay · error

skip_menu must be a boolean

Error message

skip_menu must be a boolean

What it means

The 'skip_menu' field of an UpgradeSelect callback result must be a Lua boolean; any other type (number, string, nil handled separately) yields 'skip_menu must be a boolean'. Thrown because SkipMenu directly controls whether yay shows the interactive upgrade menu.

Solutions

  1. Use true or false literals for skip_menu
  2. Remove the skip_menu key if you want the default behavior
  3. Replace skip_menu = 1 with skip_menu = true
  4. Audit other hook results for the same 0/1 habit

Example fix

-- before
return { skip_menu = 1 }
-- after
return { skip_menu = true }
Defensive patterns

Strategy: validation

Validate before calling

if r.skip_menu ~= nil and type(r.skip_menu) ~= 'boolean' then error('skip_menu must be true or false') end

Type guard

local function hasBoolSkipMenu(r) return r == nil or r.skip_menu == nil or type(r.skip_menu) == 'boolean' end

Prevention

When it happens

Trigger: Callback returns { skip_menu = 1 }, { skip_menu = 'yes' }, or similar truthy non-boolean values.

Common situations: Users porting shell/env conventions (0/1, 'true'/'false' strings) into Lua; confusing Lua truthiness with strict typing enforced by the parser.

Related errors


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

Appendix: source

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

			}

			name := string(lname)
			if !validExcludes.Contains(name) {
				parseErr = fmt.Errorf("unknown upgrade exclusion %q", name)
				return
			}

			result.Exclude = append(result.Exclude, name)
		})
		if parseErr != nil {
			return result, parseErr
		}
	}

	if skipMenuValue := tbl.RawGetString("skip_menu"); skipMenuValue != glua.LNil {
		skipMenu, ok := skipMenuValue.(glua.LBool)
		if !ok {
			return result, fmt.Errorf("skip_menu must be a boolean")
		}

		result.SkipMenu = bool(skipMenu)
	}

	return result, nil
}

func (e *Engine) stringArray(values []string) *glua.LTable {
	tbl := e.L.NewTable()
	for _, value := range values {
		tbl.Append(glua.LString(value))
	}

	return tbl
}

func (e *Engine) RunPostInstall(event *PostInstallEvent) error {

View on GitHub (pinned to 328f4b4939)