{"record":{"id":"1906cc4650c4fe0b","repo":"xpipe-io/xpipe","slug":"couldn-t-send-request","errorCode":null,"errorMessage":"Couldn't send request","messagePattern":"Couldn't send request","errorType":"exception","errorClass":"BeaconConnectorException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/BeaconClient.java","lineNumber":64,"sourceCode":"        }\n\n        var client = HttpClient.newBuilder()\n                .followRedirects(HttpClient.Redirect.NORMAL)\n                .build();\n        HttpResponse<String> response;\n        try {\n            // Use direct IP to prevent DNS lookups and potential blocks (e.g. portmaster)\n            var uri = URI.create(\"http://127.0.0.1:\" + port + prov.getPath());\n            var builder = HttpRequest.newBuilder();\n            if (token != null) {\n                builder.header(\"Authorization\", \"Bearer \" + token);\n            }\n            var httpRequest = builder.uri(uri)\n                    .POST(HttpRequest.BodyPublishers.ofString(content))\n                    .build();\n            response = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());\n        } catch (Exception ex) {\n            throw new BeaconConnectorException(\"Couldn't send request\", ex);\n        }\n\n        if (AppProperties.get().isPrintBeaconMessages()) {\n            System.out.println(\"Received raw response:\");\n            System.out.println(response.body());\n        }\n\n        var se = parseServerError(response);\n        if (se.isPresent()) {\n            se.get().throwError();\n        }\n\n        var ce = parseClientError(response);\n        if (ce.isPresent()) {\n            throw ce.get().throwException();\n        }\n\n        try {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/BeaconClient.java#L46-L82","documentation":"BeaconClient.performRequest sends the HTTP POST to the xpipe daemon's beacon server and wraps any exception from client.send (connection failures, timeouts, TLS errors, IO problems) into BeaconConnectorException('Couldn't send request'). It signals the request never got a response, as opposed to a bad response body.","triggerScenarios":"The daemon process is not running or its HTTP server port is down; wrong port/address configured; firewall or proxy blocking localhost/remote connection; connection reset or socket timeout during send; TLS handshake failure against an HTTPS beacon endpoint.","commonSituations":"Calling XPipe from a script before the daemon was started; daemon crashed mid-session; connecting to a remote machine whose beacon server is unreachable; port conflicts after config changes.","solutions":["Confirm the xpipe daemon is running and listening (launch it, check its log output for the beacon port).","Verify the beacon address/port used by BeaconClient matches the daemon's configuration.","Test reachability with a raw connection (curl / ping / telnet) to the host:port and fix network/firewall/proxy issues.","Retry after transient network problems, and consider a timeout/retry policy around performRequest."],"exampleFix":"// before\nclient.performRequest(req); // BeaconConnectorException if daemon down\n// after\ntry {\n    client.performRequest(req);\n} catch (BeaconConnectorException e) {\n    if (!isDaemonReachable()) startDaemon();\n    client.performRequest(req);\n}","handlingStrategy":"retry","validationCode":"// check daemon reachability first\nboolean up = new Socket().isConnected(); // or try connecting to host:port\nHttpClient.newHttpClient().send(HttpRequest.newBuilder(URI.create(beaconUrl + \"/ping\")).build(), HttpResponse.BodyHandlers.ofString());","typeGuard":null,"tryCatchPattern":"try {\n    return client.performRequest(req);\n} catch (BeaconConnectorException e) {\n    if (e.getCause() instanceof ConnectException || e.getCause() instanceof HttpTimeoutException) {\n        ensureDaemonRunning();\n        return client.performRequest(req); // one retry\n    }\n    throw e;\n}","preventionTips":["Start/verify the xpipe daemon before issuing beacon requests","Pin and check the configured beacon port against the daemon log","Add connect timeouts and a bounded retry for transient network issues"],"tags":["http","network","beacon","connection"],"backgroundTag":"connection-refused","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"}