{"record":{"id":"e8c3ea36e6b82f3b","repo":"wailsapp/wails","slug":"implement-me","errorCode":null,"errorMessage":"implement me","messagePattern":"implement me","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/pkg/application/menuitem_linux.go","lineNumber":141,"sourceCode":"\tresult.setDisabled(result.menuItem.disabled)\n\treturn result\n}\n\nfunc newSpeechMenu() *MenuItem {\n\tspeechMenu := NewMenu()\n\tspeechMenu.Add(\"Start Speaking\").\n\t\tSetAccelerator(\"CmdOrCtrl+OptionOrAlt+Shift+.\").\n\t\tOnClick(func(ctx *Context) {})\n\tspeechMenu.Add(\"Stop Speaking\").\n\t\tSetAccelerator(\"CmdOrCtrl+OptionOrAlt+Shift+,\").\n\t\tOnClick(func(ctx *Context) {})\n\tsubMenu := NewSubMenuItem(\"Speech\")\n\tsubMenu.submenu = speechMenu\n\treturn subMenu\n}\n\nfunc newFrontMenuItem() *MenuItem {\n\tpanic(\"implement me\")\n}\n\nfunc newHideMenuItem() *MenuItem {\n\treturn NewMenuItem(\"Hide \" + globalApplication.options.Name).\n\t\tSetAccelerator(\"CmdOrCtrl+h\").\n\t\tOnClick(func(ctx *Context) {})\n}\n\nfunc newHideOthersMenuItem() *MenuItem {\n\treturn NewMenuItem(\"Hide Others\").\n\t\tSetAccelerator(\"CmdOrCtrl+OptionOrAlt+h\").\n\t\tOnClick(func(ctx *Context) {})\n}\n\nfunc newUnhideMenuItem() *MenuItem {\n\treturn NewMenuItem(\"Show All\").\n\t\tOnClick(func(ctx *Context) {})\n}","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/wailsapp/wails/blob/0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3/v3/pkg/application/menuitem_linux.go#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Do not call the unexported newFrontMenuItem(); use the exported NewFrontMenuItem() or NewRole(Front), which builds a generic 'Bring All to Front' item without panicking.","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.","Keep role dispatch going through NewRole's switch in menuitem.go, which only touches the non-panicking exported constructors.","Track the upstream Linux menu completion work (GitHub issues on wailsapp/wails) before wiring these stubs in your fork."],"exampleFix":"// before\nfunc newFrontMenuItem() *MenuItem {\n\tpanic(\"implement me\")\n}\n\n// after\nfunc newFrontMenuItem() *MenuItem {\n\treturn NewMenuItem(\"Bring All to Front\").\n\t\tOnClick(func(ctx *Context) {\n\t\t\tfor _, w := range globalApplication.Window.List() {\n\t\t\t\tw.Show()\n\t\t\t}\n\t\t})\n}","handlingStrategy":"validation","validationCode":"// Before building platform role menus, prefer the exported API:\nitem := app.NewFrontMenuItem() // safe on all platforms\n// or:\nmenu.AddRole(app.Front) // routes to exported constructor, never the stub","typeGuard":"// Guard against unimplemented platform helpers: only call the\n// exported constructors, which have no panic paths.\nfunc safeRoleItem(role app.Role) *app.MenuItem {\n\tdefer func() { _ = recover() }() // belt and braces\n\treturn app.NewRole(role)\n}","tryCatchPattern":"defer func() {\n\tif r := recover(); r != nil {\n\t\tlog.Printf(\"role menu item unavailable: %v\", r)\n\t}\n}()\nmenu.AddRole(app.Front)","preventionTips":["Never call Wails' unexported new*MenuItem helpers, even from forks — use NewRole/exported constructors.","Grep your diff for 'new[A-Z].*MenuItem(' to catch accidental internal calls.","On Linux, hide macOS-specific Window-menu roles your app doesn't need.","Track upstream GTK4 menu completion issues before relying on role parity."],"tags":["linux","gtk4","menus","not-implemented","panic"],"backgroundTag":null,"analyzedSha":"0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3","analyzedAt":"2026-08-15T14:17:36.034Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}