different-ai/openwork · error

The desktop entry was installed, but the desktop did not sel

Error message

The desktop entry was installed, but the desktop did not select it as the openwork:// handler.

What it means

After xdg-mime registration succeeds, install() calls getStatus() and requires status.state === 'integrated'. If the desktop entry was written and registered but verification shows the desktop did not actually select OpenWork as the openwork:// handler, this error is thrown and install() returns ok:false.

Source

Thrown at apps/desktop/electron/linux-desktop-integration.mjs:451

        appVersion: app.getVersion(),
        distribution,
      }));

      const state = await readState();
      if (before.handlerDesktopId && before.handlerDesktopId !== OPENWORK_DESKTOP_ID) {
        state.previousProtocolHandler = before.handlerDesktopId;
      }
      state.dismissedAppImages = state.dismissedAppImages.filter((candidate) => candidate !== appImagePath);
      await writeState(state);

      await refreshDesktopCaches();
      const registration = await runCommand("xdg-mime", ["default", OPENWORK_DESKTOP_ID, OPENWORK_PROTOCOL_MIME]);
      if (!registration.ok) {
        throw new Error(registration.stderr || "xdg-mime could not register openwork://.");
      }
      const status = await getStatus();
      if (status.state !== "integrated") {
        throw new Error("The desktop entry was installed, but the desktop did not select it as the openwork:// handler.");
      }
      return { ok: true, status };
    } catch (error) {
      return {
        ok: false,
        status: await getStatus(),
        error: error instanceof Error ? error.message : String(error),
      };
    }
  }

  /** @returns {Promise<DesktopIntegrationResult>} */
  async function remove() {
    if (!supported) {
      return { ok: false, status: unsupportedStatus(), error: "Desktop integration is unavailable." };
    }
    const before = await getStatus();
    if (before.ownership !== "openwork") {

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Check `xdg-mime query default x-scheme-handler/openwork` and set it manually to OPENWORK_DESKTOP_ID if another handler is listed.
  2. Remove/override the competing .desktop entry claiming the openwork:// scheme, then rerun install().
  3. Run `update-desktop-database` and log out/in so the DE re-reads defaults.
  4. Inspect getStatus() status.state for the exact non-integrated state to see whether ownership or handler detection failed.

Example fix

// before
await install(); // ok:false, handler not selected
// after
const res = await install();
if (!res.ok) {
  console.error(res.error, 'current handler:', execSync('xdg-mime query default x-scheme-handler/openwork').toString());
}
Defensive patterns

Strategy: validation

Validate before calling

import { execSync } from 'node:child_process';
const handler = execSync('xdg-mime query default x-scheme-handler/openwork').toString().trim();
if (handler !== 'openwork.desktop') {
  console.warn('openwork:// handler is:', handler || '(none)');
}

Try / catch

const res = await integration.install();
if (!res.ok) {
  console.error('Integration incomplete:', res.error, 'state:', res.status.state);
}

Prevention

When it happens

Trigger: install() on Linux where xdg-mime reported success but a later getStatus() shows the mimeapps.list still points at another handler or none — e.g. another desktop entry overrides it, a stale default was re-applied by the DE, or the cache refresh didn't propagate.

Common situations: GNOME/KDE reverting the default handler after cache refresh; competing apps (browsers, other Electron apps) owning x-scheme-handler/openwork; read-only or synced mimeapps.list; AppImage runs in an environment where the DE ignores user defaults.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/01980d22dfe9d3c6. Report an issue: GitHub.