{"record":{"id":"cfc9e5d86f35ba61","repo":"xpipe-io/xpipe","slug":"no-active-shell-session-known-for-id-uuid","errorCode":null,"errorMessage":"No active shell session known for id \" + uuid","messagePattern":"No active shell session known for id \" \\+ uuid","errorType":"exception","errorClass":"BeaconClientException","httpStatus":400,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/AppBeaconCache.java","lineNumber":23,"sourceCode":"\nimport lombok.Value;\n\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.UUID;\n\n@Value\npublic class AppBeaconCache {\n\n    Set<BeaconShellSession> shellSessions = new HashSet<>();\n\n    public BeaconShellSession getShellSession(UUID uuid) throws Exception {\n        var found = shellSessions.stream()\n                .filter(beaconShellSession ->\n                        beaconShellSession.getEntry().getUuid().equals(uuid))\n                .findFirst();\n        if (found.isEmpty()) {\n            throw new BeaconClientException(\"No active shell session known for id \" + uuid);\n        }\n\n        var sc = found.get().getControl();\n        if (!sc.isRunning(true) || sc.isAnyStreamClosed()) {\n            sc.restart();\n        }\n\n        return found.get();\n    }\n\n    public BeaconShellSession getOrStart(DataStoreEntryRef<ShellStore> ref) throws Exception {\n        var existing = AppBeaconServer.get().getCache().getShellSessions().stream()\n                .filter(beaconShellSession -> beaconShellSession.getEntry().equals(ref.get()))\n                .findFirst();\n        var control = (existing.isPresent()\n                ? existing.get().getControl()\n                : ref.getStore().standaloneControl().start());\n        control.setNonInteractive();","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/AppBeaconCache.java#L5-L41","documentation":"XPipe's beacon server keeps an in-memory registry of active shell sessions keyed by UUID. getShellSession throws BeaconClientException when the requested UUID does not match any session currently tracked in shellSessions. This means the daemon either never created the session, already discarded it, or the client supplied a stale/wrong id.","triggerScenarios":"Calling a beacon API that references a shell session UUID which is not registered: the daemon restarted and lost in-memory sessions, the session was removed/closed earlier, the UUID was mistyped or came from another daemon instance, or the client cached an id across a reconnect.","commonSituations":"Client applications persisting session UUIDs across daemon restarts; sharing UUIDs between different xpipe daemon instances; long-running scripts holding ids after the shell connection was closed and reaped; automation that resumes from a saved config pointing at an old session.","solutions":["Verify the UUID corresponds to a session created by the currently running xpipe daemon (daemon restarts clear shellSessions).","List current sessions / re-open the connection via the XPipe API to obtain a fresh, valid UUID before retrying.","Re-create the shell session (re-open the connection) if it was closed, then use the new session id.","Check that the client talks to the same daemon instance that owns the session (not a second local daemon or remote installation)."],"exampleFix":"// before\nvar session = client.getShellSession(oldUuid); // throws if stale\n// after\nUUID id = existingSessions.stream().map(BeaconShellSession::getEntry).map(e -> e.getUuid())\n        .filter(oldUuid::equals).findFirst().orElseGet(() -> openNewSessionAndGetUuid());\nvar session = client.getShellSession(id);","handlingStrategy":"try-catch","validationCode":"boolean known = sessions.stream().anyMatch(s -> s.getEntry().getUuid().equals(uuid));","typeGuard":"boolean isValidSession(UUID uuid, List<BeaconShellSession> sessions) {\n    return uuid != null && sessions.stream()\n        .anyMatch(s -> s.getEntry().getUuid() != null && s.getEntry().getUuid().equals(uuid));\n}","tryCatchPattern":"try {\n    var session = cache.getShellSession(uuid);\n} catch (BeaconClientException e) {\n    // session unknown: re-open connection to obtain a fresh session id\n    var fresh = reopenConnectionAndGetSession();\n}","preventionTips":["Do not persist shell session UUIDs across daemon restarts","Re-fetch the session list after any reconnect instead of caching ids","Log the UUID on failure to distinguish typos from stale sessions"],"tags":["beacon","shell-session","stale-uuid","resource-not-found"],"backgroundTag":"resource-not-found","analyzedSha":"d85ca821baa46092a320ebb13546d7240adb74f8","analyzedAt":"2026-09-06T14:30:08.251Z","contentChangedAt":"2026-09-06T14:30:08.251Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}