{"record":{"id":"252c334e447c6bf4","repo":"xpipe-io/xpipe","slug":"multiple-connections-found-connectionpaths","errorCode":null,"errorMessage":"Multiple connections found: \" + connectionPaths","messagePattern":"Multiple connections found: \" \\+ connectionPaths","errorType":"exception","errorClass":"BeaconClientException","httpStatus":400,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/mcp/McpToolHandler.java","lineNumber":142,"sourceCode":"        }\n\n        public FilePath getFilePath(ShellControl sc, String key) throws Exception {\n            var s = getStringArgument(key);\n            var path = FilePath.parse(s);\n            if (path == null) {\n                throw new BeaconClientException(\"Invalid argument for key \" + key);\n            }\n            return path.resolveTildeHome(sc.view().userHome());\n        }\n\n        public DataStoreEntryRef<?> getDataStoreRef(String name) throws BeaconClientException {\n            var found = DataStorageQuery.queryUserInput(name);\n            if (found.isEmpty()) {\n                throw new BeaconClientException(\"No connection found for input \" + name);\n            }\n\n            if (found.size() > 1) {\n                throw new BeaconClientException(\"Multiple connections found: \"\n                        + found.stream()\n                                .map(entry ->\n                                        DataStorage.get().getStorePath(entry).toString())\n                                .toList());\n            }\n\n            var e = found.getFirst();\n            return e.ref();\n        }\n\n        public DataStoreEntryRef<ShellStore> getShellStoreRef(String name, boolean mutation)\n                throws BeaconClientException {\n            var ref = getDataStoreRef(name);\n            var isShell = ref.getStore() instanceof ShellStore;\n            if (!isShell) {\n                throw new BeaconClientException(\"Connection \"\n                        + DataStorage.get().getStorePath(ref.get()).toString() + \" is not a shell connection\");\n            }","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/mcp/McpToolHandler.java#L124-L160","documentation":"McpToolHandler.getDataStoreRef throws this BeaconClientException when DataStorageQuery.queryUserInput(name) matches more than one connection, making the reference ambiguous. The error message lists all matching store paths so the caller can disambiguate.","triggerScenarios":"Passing a connection name/query that is a prefix of, or partially matches, multiple stored connections, so queryUserInput returns size() > 1.","commonSituations":"Several connections share the same display name in different categories; using a short name like 'server' when 'servers/web/server' and 'servers/db/server' both exist; duplicated connections after an import/merge of a data store.","solutions":["Use the full store path shown in the error message (e.g. 'Category / group / name') instead of the bare name","Rename duplicate connections in the XPipe UI to make names unique","Include category/group qualifiers in the query input to narrow the match","Catch BeaconClientException, parse the listed candidates, and retry with one exact path"],"exampleFix":"// before\nreq.getDataStoreRef(\"server\") // ambiguous\n// after\nreq.getDataStoreRef(\"Servers / web / server\")","handlingStrategy":"validation","validationCode":"// disambiguate before calling\nconst matches = connections.filter(c => c.name.includes(query));\nif (matches.length > 1) {\n  throw new Error(`ambiguous connection '${query}'; candidates: ${matches.map(c => c.path).join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try { return tool.call({name}); } catch (BeaconClientException e) { if (e.message.startsWith('Multiple connections found:')) { /* parse candidate paths from e.message and retry with the exact one */ } throw e; }","preventionTips":["Always pass fully qualified store paths (category / group / name)","Keep connection display names unique within a data store","Avoid duplicate imports that create same-named connections"],"tags":["mcp","ambiguous-identifier","datastore"],"backgroundTag":"invalid-identifier","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"}