kovidgoyal/kitty · error

failed to export interface: %s at object path: %s with error

Error message

failed to export interface: %s at object path: %s with error: %w

What it means

Raised by Portal.ExportInterface when conn.ExportWithMap fails to export the D-Bus interface at the given object path. It wraps the underlying godbus error and identifies which interface and object path failed.

Source

Thrown at kittens/desktop_ui/portal.go:135

	if len(method_spec) > 0 {
		for method_name, args := range method_spec {
			method_map[method_name] = method_name
			meth_args := make([]introspect.Arg, len(args))
			for i, a := range args {
				meth_args[i] = introspect.Arg{
					Name:      a.Name,
					Type:      a.Type,
					Direction: utils.IfElse(a.Out, "out", "in"),
				}
			}
			methods = append(methods, introspect.Method{
				Name: method_name,
				Args: meth_args,
			})
		}
	}
	if err = conn.ExportWithMap(object, method_map, op, interface_name); err != nil {
		return fmt.Errorf("failed to export interface: %s at object path: %s with error: %w", interface_name, object_path, err)
	}
	var properties []introspect.Property
	p := prop.Map{interface_name: prop_spec}
	if len(prop_spec) > 0 {
		if props, err := prop.Export(conn, op, p); err != nil {
			return fmt.Errorf("failed to export properties with error: %w", err)
		} else {
			properties = props.Introspection(interface_name)
		}
	}
	var signals []introspect.Signal
	if len(signal_spec) > 0 {
		for signal_name, args := range signal_spec {
			sig_args := make([]introspect.Arg, len(args))
			for i, a := range args {
				sig_args[i] = introspect.Arg{
					Name:      a.Name,
					Type:      a.Type,

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Ensure only one instance of the desktop-ui kitten server is running per session bus
  2. Check the bus connection is alive (dbus.SessionBus() succeeded) before exporting
  3. Verify the object path is a valid D-Bus path (starts with /, no trailing slash)
  4. Inspect the wrapped %w error for the godbus-specific cause
Defensive patterns

Strategy: try-catch

Try / catch

if err := portal.Start(); err != nil {
    if strings.Contains(err.Error(), "failed to export interface") {
        // inspect wrapped cause; likely duplicate export or dead connection
    }
}

Prevention

When it happens

Trigger: Exporting a D-Bus interface when the connection is closed, the object path is invalid, or an interface with the same name is already exported on the connection.

Common situations: Starting the desktop-ui portal twice over the same bus connection; a malformed object path; the session bus connection dropped between connect and export.

Related errors


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