apache/seatunnel · warning

HugeGraph connection failed on attempt {}/{}. Error: {}

Error message

HugeGraph connection failed on attempt {}/{}. Error: {}

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/client/HugeGraphClient.java:284

            } catch (HugeGraphConnectorException e) {
                if (!HugeGraphConnectorErrorCode.BUILD_CLIENT_FAILED
                        .getCode()
                        .equals(e.getSeaTunnelErrorCode().getCode())) {
                    throw e;
                }
                if (!idempotent) {
                    throw e;
                }
                reconnect();
                if (attempt == totalAttempts) {
                    throw new HugeGraphConnectorException(
                            HugeGraphConnectorErrorCode.BUILD_CLIENT_FAILED,
                            "Failed to establish HugeGraph connection after "
                                    + totalAttempts
                                    + " attempt(s)",
                            e);
                }
                LOG.warn(
                        "HugeGraph connection failed on attempt {}/{}. Error: {}",
                        attempt,
                        totalAttempts,
                        e.getMessage());
                sleepBeforeRetry(attempt);
            } catch (Exception e) {
                LOG.error("Non-retryable error executing graph operation: {}", e.getMessage(), e);
                throw new HugeGraphConnectorException(
                        HugeGraphConnectorErrorCode.GRAPH_OPERATION_FAILED,
                        "Non-retryable error executing graph operation: " + e.getMessage(),
                        e);
            }
        }
    }

    /**
     * Deterministic 4xx responses (bad request, semantic rejection such as exceeding the server
     * batch size cap) cannot succeed on retry. Only connection-level failures and 5xx server errors

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify url/host, port, and graph name in the connector configuration resolve to a running HugeGraph
  2. Test connectivity from the worker: curl http://<host>:<port>/graphs
  3. Check DNS resolution and firewall rules in containerized deployments
  4. If the server is slow to start, increase totalAttempts/retry interval so early attempts aren't exhausted

Example fix

// before
url = "http://hugegraph-internal:8080"
// after: verify reachable & correct graph
// curl http://hugegraph-internal:8080/graphs/hugegraph
url = "http://hugegraph-svc.hugegraph.svc.cluster.local:8080"
Defensive patterns

Strategy: validation

Validate before calling

// Run on every worker host before job submission
import java.net.HttpURLConnection; import java.net.URL;
URL u = new URL(baseUrl + "/graphs");
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setConnectTimeout(5000);
if (c.getResponseCode() != 200) throw new IllegalStateException("HugeGraph not reachable: " + baseUrl);

Try / catch

try {
    sink.initialize(...);
} catch (HugeGraphConnectorException e) {
    if (e.getErrorCode() == HugeGraphConnectorErrorCode.BUILD_CLIENT_FAILED) {
        // verify URL/server, then resubmit after connectivity is fixed
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/c53f44f9ab42d5ed. Report an issue: GitHub.