different-ai/openwork · error
xdg-mime could not register openwork://.
Error message
xdg-mime could not register openwork://.
What it means
During Linux AppImage desktop integration, install() writes the .desktop entry and icons, then registers OpenWork as the openwork:// x-scheme-handler by running `xdg-mime default <desktop-id> <mime>`. If that command exits non-zero (registration.ok false), it throws either the command's stderr or this fallback message.
Source
Thrown at apps/desktop/electron/linux-desktop-integration.mjs:447
}
await atomicWrite(desktopEntryPath, buildOpenworkDesktopEntry({
appImagePath,
appName,
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) {View on GitHub (pinned to 2b7df46e8a)
Solutions
- Install xdg-utils (`sudo apt install xdg-utils` / `dnf install xdg-utils`) so xdg-mime is on PATH.
- Run the app outside sandbox confinement or grant write access to ~/.config/mimeapps.list.
- Manually set the handler (`xdg-mime default openwork.desktop x-scheme-handler/openwork`) and re-run integration to confirm.
- If the message appears instead of stderr, capture the exit code of the registration command to find the real failure.
Example fix
// before
await install(); // throws when xdg-mime absent
// after
if (!commandExists('xdg-mime')) {
console.error('Install xdg-utils to enable openwork:// registration.');
return;
}
await install(); Defensive patterns
Strategy: try-catch
Validate before calling
import { execFileSync } from 'node:child_process';
function xdgMimeAvailable() {
try { execFileSync('xdg-mime', ['--version'], { stdio: 'ignore' }); return true; }
catch { return false; }
} Try / catch
try {
const res = await integration.install();
if (!res.ok) console.error('openwork:// registration failed:', res.error);
} catch (err) {
console.error('xdg-mime registration failed:', err.message);
} Prevention
- Install xdg-utils on target Linux images and CI containers.
- Verify ~/.config/mimeapps.list is writable before integrating.
- Test integration outside snap/flatpak confinement where xdg-mime writes are blocked.
- Check `xdg-mime --version` availability at app startup and degrade gracefully.
When it happens
Trigger: install() on Linux when `xdg-mime` is missing from PATH, exits non-zero, or writes nothing to stderr so the fallback message is used; also when the XDG data dirs are not writable so the mimeapps.list update fails.
Common situations: Minimal/headless or Wayland-only environments without xdg-utils installed; containerized or snap/flatpak-sandboxed apps where xdg-mime cannot write to ~/.config/mimeapps.list; corrupt PATH in the spawned environment.
Related errors
- The desktop entry was installed, but the desktop did not sel
- Electron desktop helper is unavailable: ${command}
- Only valid web links can be opened externally.
- External URL protocol "${parsed.protocol}" is not allowed.
- Failed to open browser
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/e754fe968fc57228.
Report an issue: GitHub.