wailsapp/wails · error

implement me

Error message

implement me

What it means

newFrontMenuItem is an unimplemented constructor stub in Wails v3's legacy Linux GTK3 menu backend (menuitem_linux_gtk3.go). Building any menu that includes the 'Front' role on Linux makes NewRole (menuitem.go:144-145) call NewFrontMenuItem(), which immediately panics with 'implement me'. The panic happens at menu-construction time (app startup), so the process crashes before a window appears.

Source

Thrown at v3/pkg/application/menuitem_linux_gtk3.go:152

func newSpeechMenu() *MenuItem {
	speechMenu := NewMenu()
	speechMenu.Add("Start Speaking").
		SetAccelerator("CmdOrCtrl+OptionOrAlt+Shift+.").
		OnClick(func(ctx *Context) {
			//			C.startSpeaking()
		})
	speechMenu.Add("Stop Speaking").
		SetAccelerator("CmdOrCtrl+OptionOrAlt+Shift+,").
		OnClick(func(ctx *Context) {
			//			C.stopSpeaking()
		})
	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) {

			//			C.hideApplication()
		})
}

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

View on GitHub (pinned to 0e754b1b40)

Solutions

  1. Remove the AddRole(application.Front) call on Linux and add a plain item instead: Add(NewMenuItem("Bring All to Front").OnClick(...))
  2. Guard role usage behind runtime.GOOS == "darwin" so the role is only added where it is implemented
  3. If the role is required, implement newFrontMenuItem yourself in menuitem_linux.go/menuitem_linux_gtk3.go following the pattern of neighboring implemented items (e.g. newHideMenuItem), and file an upstream issue at wailsapp/wails

Example fix

// before
myMenu.AddRole(application.Front)

// after
if runtime.GOOS == "darwin" {
	myMenu.AddRole(application.Front)
}
Defensive patterns

Strategy: validation

Validate before calling

// Only add role-based items where the Linux backend implements them
var linuxSupportedRoles = map[application.Role]bool{
	application.Cut: true, application.Copy: true, application.Paste: true,
	application.SelectAll: true, application.Quit: true, application.FullScreen: true,
	// Front, Hide, HideOthers etc. depend on version: verify per release
}
func safeAddRole(m *application.Menu, r application.Role) {
	if runtime.GOOS == "linux" && !linuxSupportedRoles[r] {
		return
	}
	m.AddRole(r)
}

Try / catch

defer func() {
	if r := recover(); r != nil {
		log.Printf("menu construction failed (unsupported role?): %v", r)
	}
}()
app.Menu.AddRole(application.Front)

Prevention

When it happens

Trigger: Calling App.Menu.AddRole(application.Front) (or NewFrontMenuItem()) on Linux, including in a GTK3-legacy build compiled with -tags gtk3. The panic fires during NewRole's switch dispatch, before the menu is ever rendered.

Common situations: Porting a macOS menu (where Front belongs in the Window menu) to Linux; copying cross-platform sample code that adds role-based items unconditionally; upgrading to v3 and reusing v2-era role menus.

Related errors


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