{"record":{"id":"540526fd3ff8e0e7","repo":"xpipe-io/xpipe","slug":"unsupported-mode-msg-getmode-getdisplayname","errorCode":null,"errorMessage":"Unsupported mode: \" + msg.getMode().getDisplayName() + \". Supported: \" + String.join(\", \", supportedModeIds)","messagePattern":"Unsupported mode: \" \\+ msg\\.getMode\\(\\)\\.getDisplayName\\(\\) \\+ \"\\. Supported: \" \\+ String\\.join\\(\", \", supportedModeIds\\)","errorType":"exception","errorClass":"BeaconClientException","httpStatus":400,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/api/DaemonModeExchange.java","lineNumber":25,"sourceCode":"\nimport com.sun.net.httpserver.HttpExchange;\nimport lombok.Builder;\nimport lombok.NonNull;\nimport lombok.Value;\nimport lombok.extern.jackson.Jacksonized;\n\npublic class DaemonModeExchange extends BeaconInterface<DaemonModeExchange.Request> {\n\n    @Override\n    public String getPath() {\n        return \"/daemon/mode\";\n    }\n\n    @Override\n    public Object handle(HttpExchange exchange, Request msg) throws BeaconClientException {\n        var mode = AppOperationMode.map(msg.getMode());\n        if (!mode.isSupported()) {\n            throw new BeaconClientException(\"Unsupported mode: \" + msg.getMode().getDisplayName()\n                    + \". Supported: \"\n                    + String.join(\n                            \", \",\n                            AppOperationMode.getAll().stream()\n                                    .filter(AppOperationMode::isSupported)\n                                    .map(AppOperationMode::getId)\n                                    .toList()));\n        }\n\n        AppOperationMode.switchToSyncIfPossible(mode);\n        return Response.builder().usedMode(msg.getMode()).build();\n    }\n\n    @Override\n    public boolean requiresEnabledApi() {\n        return false;\n    }\n","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/api/DaemonModeExchange.java#L7-L43","documentation":"The daemon's mode-switch endpoint received a DaemonMode whose target AppOperationMode is not supported in this environment. XPipe builds modes conditionally (e.g. headless vs desktop variants), so a mode id that exists on one installation may not be available or startable on another. The error lists all currently supported mode ids to guide the client.","triggerScenarios":"Posting to DaemonModeExchange with msg.getMode() mapping to an AppOperationMode whose isSupported() is false — e.g. requesting 'desktop' mode on a headless server build, or a build lacking a specific operation-mode module.","commonSituations":"Switching the daemon to background/desktop mode from a client on a machine whose XPipe package was compiled without that mode; CI/headless containers receiving the same requests used on desktop machines; stale clients sending mode ids removed in a newer daemon.","solutions":["Read the 'Supported: ...' list from the error and only request one of those mode ids","Install the XPipe variant that includes the desired operation mode (e.g. full desktop package instead of headless)","Update the client library so its DaemonMode enum matches the daemon's supported modes","Skip the mode-switch call on headless systems and keep the default mode"],"exampleFix":"// before\nclient.setMode(DaemonMode.GUI);\n// after\nif (supportedModes.contains(\"gui\")) {\n    client.setMode(DaemonMode.GUI);\n} else {\n    logger.warn(\"GUI mode unsupported on this daemon; staying in \" + currentMode);\n}","handlingStrategy":"validation","validationCode":"Set<String> supported = fetchSupportedModes();\nif (!supported.contains(requestedMode.getId())) {\n    throw new IllegalArgumentException(\"Mode \" + requestedMode + \" unsupported; supported: \" + supported);\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.setMode(mode);\n} catch (BeaconClientException e) {\n    if (e.getMessage().startsWith(\"Unsupported mode\")) {\n        logger.warn(\"Falling back to current mode: \" + e.getMessage());\n    } else throw e;\n}","preventionTips":["Parse the 'Supported:' list from the error message","Detect headless/desktop builds before sending mode-switch requests","Keep client mode enum in sync with the daemon version"],"tags":["beacon-api","operation-mode","unsupported"],"backgroundTag":"invalid-enum-value","analyzedSha":"d85ca821baa46092a320ebb13546d7240adb74f8","analyzedAt":"2026-09-06T14:30:08.251Z","contentChangedAt":"2026-09-06T14:30:08.251Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}