wailsapp/wails · error

implement me

Error message

implement me

What it means

newFrontMenuItem (v3/pkg/application/menuitem_linux.go:141) is an unexported Linux placeholder for the macOS-style 'Bring All to Front' role helper; on Linux the body is just panic("implement me"). The GTK4 Linux port has not implemented the platform-specific front-most-window behavior for this role, so the stub crashes instead of returning a MenuItem. Note the exported NewFrontMenuItem() (menuitem_roles.go:26) does NOT panic — it returns a plain item — so only internal/future wiring of this lowercase helper can trigger it.

Source

Thrown at v3/pkg/application/menuitem_linux.go:141

	result.setDisabled(result.menuItem.disabled)
	return result
}

func newSpeechMenu() *MenuItem {
	speechMenu := NewMenu()
	speechMenu.Add("Start Speaking").
		SetAccelerator("CmdOrCtrl+OptionOrAlt+Shift+.").
		OnClick(func(ctx *Context) {})
	speechMenu.Add("Stop Speaking").
		SetAccelerator("CmdOrCtrl+OptionOrAlt+Shift+,").
		OnClick(func(ctx *Context) {})
	subMenu := NewSubMenuItem("Speech")
	subMenu.submenu = speechMenu
	return subMenu
}

func newFrontMenuItem() *MenuItem {
	panic("implement me")
}

func newHideMenuItem() *MenuItem {
	return NewMenuItem("Hide " + globalApplication.options.Name).
		SetAccelerator("CmdOrCtrl+h").
		OnClick(func(ctx *Context) {})
}

func newHideOthersMenuItem() *MenuItem {
	return NewMenuItem("Hide Others").
		SetAccelerator("CmdOrCtrl+OptionOrAlt+h").
		OnClick(func(ctx *Context) {})
}

func newUnhideMenuItem() *MenuItem {
	return NewMenuItem("Show All").
		OnClick(func(ctx *Context) {})
}

View on GitHub (pinned to 0e754b1b40)

Solutions

  1. Do not call the unexported newFrontMenuItem(); use the exported NewFrontMenuItem() or NewRole(Front), which builds a generic 'Bring All to Front' item without panicking.
  2. If you are implementing it for Wails, mirror the implemented neighbours (e.g. newFullScreenMenuItem) and return NewMenuItem("Bring All to Front") plus an OnClick that raises all app windows.
  3. Keep role dispatch going through NewRole's switch in menuitem.go, which only touches the non-panicking exported constructors.
  4. Track the upstream Linux menu completion work (GitHub issues on wailsapp/wails) before wiring these stubs in your fork.

Example fix

// before
func newFrontMenuItem() *MenuItem {
	panic("implement me")
}

// after
func newFrontMenuItem() *MenuItem {
	return NewMenuItem("Bring All to Front").
		OnClick(func(ctx *Context) {
			for _, w := range globalApplication.Window.List() {
				w.Show()
			}
		})
}
Defensive patterns

Strategy: validation

Validate before calling

// Before building platform role menus, prefer the exported API:
item := app.NewFrontMenuItem() // safe on all platforms
// or:
menu.AddRole(app.Front) // routes to exported constructor, never the stub

Type guard

// Guard against unimplemented platform helpers: only call the
// exported constructors, which have no panic paths.
func safeRoleItem(role app.Role) *app.MenuItem {
	defer func() { _ = recover() }() // belt and braces
	return app.NewRole(role)
}

Try / catch

defer func() {
	if r := recover(); r != nil {
		log.Printf("role menu item unavailable: %v", r)
	}
}()
menu.AddRole(app.Front)

Prevention

When it happens

Trigger: Wails-internal or contributor code calling newFrontMenuItem() while building a default Window menu on Linux (GTK4 default build); porting menu code from menuitem_darwin.go that expects a platform-specific front helper; new dispatcher code that routes NewRole(Front) to the lowercase Linux helper instead of the generic menuitem_roles.go version.

Common situations: Contributing to the Wails GTK4 menu implementation; maintaining a fork that wires lowercase role helpers into NewRole; running a build where menu defaults were extended to call the Linux-specific helpers; regression after the GTK4 default-flip when old GTK3-era call sites are revived.

Related errors


AI-assisted analysis of wailsapp/wails@0e754b1b40 (2026-08-15). Data as JSON: /api/errors/e8c3ea36e6b82f3b. Report an issue: GitHub.