{"record":{"id":"c53f44f9ab42d5ed","repo":"apache/seatunnel","slug":"hugegraph-connection-failed-on-attempt-erro","errorCode":null,"errorMessage":"HugeGraph connection failed on attempt {}/{}. Error: {}","messagePattern":"HugeGraph connection failed on attempt (.+?)/(.+?)\\. Error: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/client/HugeGraphClient.java","lineNumber":284,"sourceCode":"            } catch (HugeGraphConnectorException e) {\n                if (!HugeGraphConnectorErrorCode.BUILD_CLIENT_FAILED\n                        .getCode()\n                        .equals(e.getSeaTunnelErrorCode().getCode())) {\n                    throw e;\n                }\n                if (!idempotent) {\n                    throw e;\n                }\n                reconnect();\n                if (attempt == totalAttempts) {\n                    throw new HugeGraphConnectorException(\n                            HugeGraphConnectorErrorCode.BUILD_CLIENT_FAILED,\n                            \"Failed to establish HugeGraph connection after \"\n                                    + totalAttempts\n                                    + \" attempt(s)\",\n                            e);\n                }\n                LOG.warn(\n                        \"HugeGraph connection failed on attempt {}/{}. Error: {}\",\n                        attempt,\n                        totalAttempts,\n                        e.getMessage());\n                sleepBeforeRetry(attempt);\n            } catch (Exception e) {\n                LOG.error(\"Non-retryable error executing graph operation: {}\", e.getMessage(), e);\n                throw new HugeGraphConnectorException(\n                        HugeGraphConnectorErrorCode.GRAPH_OPERATION_FAILED,\n                        \"Non-retryable error executing graph operation: \" + e.getMessage(),\n                        e);\n            }\n        }\n    }\n\n    /**\n     * Deterministic 4xx responses (bad request, semantic rejection such as exceeding the server\n     * batch size cap) cannot succeed on retry. Only connection-level failures and 5xx server errors","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/client/HugeGraphClient.java#L266-L302","documentation":"WARN from HugeGraphClient.executeGraphOperation while retrying connection establishment after a connection-level failure during a graph write. On the final attempt, instead of this warning a HugeGraphConnectorException with error code BUILD_CLIENT_FAILED ('Failed to establish HugeGraph connection after N attempt(s)') is thrown and the write fails.","triggerScenarios":"executeIdempotentWrite -> executeGraphOperation fails to connect (client build/connect exception) and sleepBeforeRetry schedules another attempt; seen for attempts 1..totalAttempts-1, with the final failure surfaced as an exception.","commonSituations":"Wrong host/port or schema name in sink config, HugeGraph server down or unreachable from worker nodes, DNS failures in container/Kubernetes environments, firewall/security-group rules blocking the REST port.","solutions":["Verify url/host, port, and graph name in the connector configuration resolve to a running HugeGraph","Test connectivity from the worker: curl http://<host>:<port>/graphs","Check DNS resolution and firewall rules in containerized deployments","If the server is slow to start, increase totalAttempts/retry interval so early attempts aren't exhausted"],"exampleFix":"// before\nurl = \"http://hugegraph-internal:8080\"\n// after: verify reachable & correct graph\n// curl http://hugegraph-internal:8080/graphs/hugegraph\nurl = \"http://hugegraph-svc.hugegraph.svc.cluster.local:8080\"","handlingStrategy":"validation","validationCode":"// Run on every worker host before job submission\nimport java.net.HttpURLConnection; import java.net.URL;\nURL u = new URL(baseUrl + \"/graphs\");\nHttpURLConnection c = (HttpURLConnection) u.openConnection();\nc.setConnectTimeout(5000);\nif (c.getResponseCode() != 200) throw new IllegalStateException(\"HugeGraph not reachable: \" + baseUrl);","typeGuard":null,"tryCatchPattern":"try {\n    sink.initialize(...);\n} catch (HugeGraphConnectorException e) {\n    if (e.getErrorCode() == HugeGraphConnectorErrorCode.BUILD_CLIENT_FAILED) {\n        // verify URL/server, then resubmit after connectivity is fixed\n    }\n    throw e;\n}","preventionTips":["Validate host/port/graph config values against the live deployment","Test connectivity from worker nodes, not just the submitter host","Use stable service DNS names in Kubernetes and verify DNS resolution","Open firewall/security-group rules for the HugeGraph REST port"],"tags":["hugegraph","connection","retry","client-init"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}