wailsapp/wails · error

Implement me

Error message

Implement me

What it means

newPrintMenuItem (v3/pkg/application/menuitem_linux.go:338) is an unimplemented Linux stub for the Print role helper; its body is only panic("Implement me"). Linux has no shared native print action for webview apps in the Wails GTK4 port, so the platform helper was left as a stub. The exported NewPrintMenuItem() (menuitem_roles.go:281) returns a normal item with a Ctrl+P accelerator and does not panic, so only code that calls this unexported helper crashes.

Source

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

			currentWindow := globalApplication.Window.Current()
			if currentWindow != nil {
				currentWindow.Zoom()
			}
		})
}

func newFullScreenMenuItem() *MenuItem {
	return NewMenuItem("Fullscreen").
		OnClick(func(ctx *Context) {
			currentWindow := globalApplication.Window.Current()
			if currentWindow != nil {
				currentWindow.Fullscreen()
			}
		})
}

func newPrintMenuItem() *MenuItem {
	panic("Implement me")
}

func newPageLayoutMenuItem() *MenuItem {
	panic("Implement me")
}

func newShowAllMenuItem() *MenuItem {
	panic("Implement me")
}

func newBringAllToFrontMenuItem() *MenuItem {
	panic("Implement me")
}

func newNewFileMenuItem() *MenuItem {
	panic("Implement me")
}

View on GitHub (pinned to 0e754b1b40)

Solutions

  1. Use the exported NewPrintMenuItem() or NewRole(Print) — they produce a plain menu item and never hit the stub.
  2. If implementing for the platform, return NewMenuItem("Print").SetAccelerator("CmdOrCtrl+p") with an OnClick that triggers window.print() via the webview.
  3. Leave role dispatch to NewRole's switch (menuitem.go:192) which only uses the safe exported constructors.
  4. Check upstream Wails issues for the Linux menu-role completion epic before adding wiring yourself.

Example fix

// before
func newPrintMenuItem() *MenuItem {
	panic("Implement me")
}

// after
func newPrintMenuItem() *MenuItem {
	return NewMenuItem("Print").
		SetAccelerator("CmdOrCtrl+p").
		OnClick(func(ctx *Context) {
			if w := globalApplication.Window.Current(); w != nil {
				_ = w.ExecJS("window.print()")
			}
		})
}
Defensive patterns

Strategy: validation

Validate before calling

// Use the public API which is implemented on all platforms:
menu.AddRole(app.Print)          // generic item with Ctrl+P
item := app.NewPrintMenuItem()   // same, explicit form

Try / catch

defer func() {
	if r := recover(); r != nil {
		log.Printf("print menu item unavailable on this platform: %v", r)
	}
}()
menu.AddRole(app.Print)

Prevention

When it happens

Trigger: Internal/contributor code invoking newPrintMenuItem() when assembling a default File menu on Linux; a fork that routes NewRole(Print) to the lowercase Linux helper; porting from menuitem_darwin.go where a real selector-based print action exists.

Common situations: Building a cross-platform File menu with a Print entry and testing custom role wiring on Linux; Wails GTK4 port development; copy-pasting dispatcher patterns from other platforms into menuitem_linux.go.

Related errors


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