Linux startup crash: invalid D-Bus name in single-instance plugin

Open Beginner friendly
#183 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
66/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
linux, rust, tauri
Domain
desktop-dev

Research direction

The panic comes from the single-instance plugin's Linux D-Bus registration in tauri-plugin-single-instance 2.4.5 (src/platform_impl/linux.rs, line 59). Start in desktop/src-tauri/src/lib.rs, where the plugin is initialised, and find the builder option that sets the bus name. Done means the app starts on Linux without the panic, with a D-Bus-legal name set in the builder and the app identifier left unchanged.

Written by the indexing model from the issue text.

Description

bug

Problem

On Linux, the app panics on launch before any window appears:

thread 'main' panicked at tauri-plugin-single-instance-2.4.5/src/platform_impl/linux.rs:59:18:
called `Result::unwrap()` on an `Err` value:
Names(InvalidName("Invalid well-known name. ..."))

macOS and Windows are unaffected.

Cause

tauri-plugin-single-instance registers a D-Bus well-known name derived from the app identifier (com.2048labs.speaktype -> com.2048labs.speaktype.SingleInstance). D-Bus names don't allow a dot-separated element to start with a digit, and 2048labs does, so registration fails and the plugin's .unwrap() panics.

This identifier has been D-Bus-illegal since a837dd1 (renamed to match SpeakType 1's app ID, for shared macOS permissions/updates), but nothing exercised D-Bus until ad88e58 (#156) added the single-instance plugin which defaults to the app identifier as its bus name.

Fix

Keep the app identifier unchanged (macOS permissions/updates depend on it) and give the plugin a separate, D-Bus-legal name via its builder API in desktop/src-tauri/src/lib.rs:

Steps to reproduce
  1. cd desktop && npm run app to start the app.
  2. It will show -> thread 'main' panicked error message
Which system?

Linux

System version

Fedora 44

SpeakType version

2.0.0

Image
Dominant language
Swift
Stars
540
Forks
74
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from karansinghgit/speaktype

All issues in karansinghgit/speaktype

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.