kovidgoyal/kitty · error
failed to connect to system bus with error: %w
Error message
failed to connect to system bus with error: %w
What it means
show_settings calls dbus.SessionBus() and wraps its failure. Despite the message text saying 'system bus', the code actually connects to the session bus — the message is slightly misleading; the cause is a session bus connection failure.
Source
Thrown at kittens/desktop_ui/portal.go:277
func fetch_settings(conn *dbus.Conn, namespaces ...string) (ans ReadAllType, err error) {
path := "/" + strings.ToLower(strings.ReplaceAll(DESKTOP_PORTAL_NAME, ".", "/"))
obj := conn.Object(DESKTOP_PORTAL_NAME, dbus.ObjectPath(path))
interface_name := strings.ReplaceAll(DESKTOP_PORTAL_NAME, "Desktop", "Settings")
if len(namespaces) == 0 {
namespaces = append(namespaces, "")
}
call := obj.Call(interface_name+".ReadAll", dbus.FlagNoAutoStart, namespaces)
if err = call.Store(&ans); err != nil {
return nil, fmt.Errorf("Failed to read response from ReadAll with error: %w", err)
}
return
}
func show_settings(opts *ShowSettingsOptions) (err error) {
conn, err := dbus.SessionBus()
if err != nil {
return fmt.Errorf("failed to connect to system bus with error: %w", err)
}
defer conn.Close()
var response ReadAllType
response, err = fetch_settings(conn, opts.InNamespace...)
if opts.AsJson {
unwrapped := make(map[string]map[string]any, len(response))
for ns, m := range response {
w := make(map[string]any, len(m))
for k, a := range m {
w[k] = a.Value()
}
unwrapped[ns] = w
}
j, err := json.MarshalIndent(unwrapped, "", " ")
if err != nil {
return fmt.Errorf("Failed to format the response as JSON: %w", err)
}
fmt.Println(string(j))View on GitHub (pinned to 6d5d0c4406)
Solutions
- Set/verify DBUS_SESSION_BUS_ADDRESS and confirm the socket exists
- Start a session bus with dbus-run-session or dbus-launch for non-graphical use
- Share the host session bus socket into containers
Defensive patterns
Strategy: validation
Validate before calling
if os.Getenv("DBUS_SESSION_BUS_ADDRESS") == "" {
return errors.New("run inside a graphical session or set DBUS_SESSION_BUS_ADDRESS")
} Try / catch
conn, err := dbus.SessionBus()
if err != nil {
// skip settings features; environment has no session bus
} Prevention
- Run the kitten inside a real graphical session
- Forward/share the session bus in SSH and container setups
When it happens
Trigger: Running `kitten desktop-ui show-settings` in an environment where the D-Bus session bus is unavailable or DBUS_SESSION_BUS_ADDRESS is unset/invalid.
Common situations: SSH sessions, containers, cron jobs, or minimal environments without a running session bus.
Related errors
- could not connect to session D-Bus: %s
- failed to register dbus name: %v
- failed to export interface: %s at object path: %s with error
- failed to export properties with error: %w
- failed to export introspected methods with error: %w
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/1760d15b2161042a.
Report an issue: GitHub.