kovidgoyal/kitty · error

failed to export introspected methods with error: %w

Error message

failed to export introspected methods with error: %w

What it means

Raised by Portal.ExportInterface when conn.Export fails to export the org.freedesktop.DBus.Introspectable interface built from the generated introspection node. This is the final export step after methods and properties.

Source

Thrown at kittens/desktop_ui/portal.go:178

			})
		}
	}

	interface_data := introspect.Interface{
		Name:       interface_name,
		Methods:    methods,
		Properties: properties,
		Signals:    signals,
	}
	interfaces := []introspect.Interface{
		introspect.IntrospectData, interface_data,
	}
	if len(properties) > 0 {
		interfaces = append(interfaces, prop.IntrospectData)
	}
	n := &introspect.Node{Name: object_path, Interfaces: interfaces}
	if err = conn.Export(introspect.NewIntrospectable(n), op, introspect.IntrospectData.Name); err != nil {
		return fmt.Errorf("failed to export introspected methods with error: %w", err)
	}
	return
}

func (self *Portal) Start() (err error) {
	if self.bus, err = dbus.SessionBus(); err != nil {
		return fmt.Errorf("could not connect to session D-Bus: %s", err)
	}
	reply, err := self.bus.RequestName(PORTAL_BUS_NAME, dbus.NameFlagDoNotQueue)
	if err != nil {
		return fmt.Errorf("failed to register dbus name: %v", err)
	}
	if reply != dbus.RequestNameReplyPrimaryOwner {
		return fmt.Errorf("can't register D-Bus name: name already taken")
	}
	props := PropSpec{
		"version": {Value: uint32(1), Writable: false, Emit: prop.EmitFalse},
	}

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Check for other running desktop-ui/portal processes on the session bus
  2. Ensure Start() is called only once per Portal instance
  3. Inspect the wrapped error from godbus for details
  4. Retry after restarting the session bus if it was interrupted
Defensive patterns

Strategy: try-catch

Try / catch

if err := portal.Start(); err != nil {
    log.Fatalf("portal startup failed: %v", err)
}

Prevention

When it happens

Trigger: The introspectable interface cannot be exported, typically because the connection is broken or the object path already hosts an introspectable implementation.

Common situations: Bus connection closed mid-setup; another portal backend already owning overlapping paths; concurrent Start() calls.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/93323677c44dea11. Report an issue: GitHub.