{"record":{"id":"01980d22dfe9d3c6","repo":"different-ai/openwork","slug":"the-desktop-entry-was-installed-but-the-desktop-d","errorCode":null,"errorMessage":"The desktop entry was installed, but the desktop did not select it as the openwork:// handler.","messagePattern":"The desktop entry was installed, but the desktop did not select it as the openwork:// handler\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/linux-desktop-integration.mjs","lineNumber":451,"sourceCode":"        appVersion: app.getVersion(),\n        distribution,\n      }));\n\n      const state = await readState();\n      if (before.handlerDesktopId && before.handlerDesktopId !== OPENWORK_DESKTOP_ID) {\n        state.previousProtocolHandler = before.handlerDesktopId;\n      }\n      state.dismissedAppImages = state.dismissedAppImages.filter((candidate) => candidate !== appImagePath);\n      await writeState(state);\n\n      await refreshDesktopCaches();\n      const registration = await runCommand(\"xdg-mime\", [\"default\", OPENWORK_DESKTOP_ID, OPENWORK_PROTOCOL_MIME]);\n      if (!registration.ok) {\n        throw new Error(registration.stderr || \"xdg-mime could not register openwork://.\");\n      }\n      const status = await getStatus();\n      if (status.state !== \"integrated\") {\n        throw new Error(\"The desktop entry was installed, but the desktop did not select it as the openwork:// handler.\");\n      }\n      return { ok: true, status };\n    } catch (error) {\n      return {\n        ok: false,\n        status: await getStatus(),\n        error: error instanceof Error ? error.message : String(error),\n      };\n    }\n  }\n\n  /** @returns {Promise<DesktopIntegrationResult>} */\n  async function remove() {\n    if (!supported) {\n      return { ok: false, status: unsupportedStatus(), error: \"Desktop integration is unavailable.\" };\n    }\n    const before = await getStatus();\n    if (before.ownership !== \"openwork\") {","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/linux-desktop-integration.mjs#L433-L469","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check `xdg-mime query default x-scheme-handler/openwork` and set it manually to OPENWORK_DESKTOP_ID if another handler is listed.","Remove/override the competing .desktop entry claiming the openwork:// scheme, then rerun install().","Run `update-desktop-database` and log out/in so the DE re-reads defaults.","Inspect getStatus() status.state for the exact non-integrated state to see whether ownership or handler detection failed."],"exampleFix":"// before\nawait install(); // ok:false, handler not selected\n// after\nconst res = await install();\nif (!res.ok) {\n  console.error(res.error, 'current handler:', execSync('xdg-mime query default x-scheme-handler/openwork').toString());\n}","handlingStrategy":"validation","validationCode":"import { execSync } from 'node:child_process';\nconst handler = execSync('xdg-mime query default x-scheme-handler/openwork').toString().trim();\nif (handler !== 'openwork.desktop') {\n  console.warn('openwork:// handler is:', handler || '(none)');\n}","typeGuard":null,"tryCatchPattern":"const res = await integration.install();\nif (!res.ok) {\n  console.error('Integration incomplete:', res.error, 'state:', res.status.state);\n}","preventionTips":["Run `update-desktop-database` (or xdg-desktop-menu) after writing .desktop entries.","Audit for other .desktop files claiming x-scheme-handler/openwork and remove conflicts.","Verify with `xdg-mime query default` in an integration test after install().","Refresh DE caches and re-login when testing default-handler changes."],"tags":["linux","desktop-integration","protocol-handler"],"backgroundTag":"protocol-handler-not-selected","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}