apache/seatunnel · error · EasysearchConnectorException

LIST_INDEX_FAILED

LIST_INDEX_FAILED

Error message

GET ${endpoint} response null

What it means

listIndex issues GET /_cat/indices?format=json and throws LIST_INDEX_FAILED if the REST client returns a null Response. It's a fail-fast guard used when enumerating all indices (e.g. for table listing in auto-catalog flows).

Source

Thrown at seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/client/EasysearchClient.java:494

     */
    public boolean checkIndexExist(String index) {
        Request request = new Request("HEAD", "/" + index.toLowerCase());
        try {
            Response response = restClient.performRequest(request);
            int statusCode = response.getStatusLine().getStatusCode();
            return statusCode == 200;
        } catch (Exception ex) {
            return false;
        }
    }

    public List<String> listIndex() {
        String endpoint = "/_cat/indices?format=json";
        Request request = new Request("GET", endpoint);
        try {
            Response response = restClient.performRequest(request);
            if (response == null) {
                throw new EasysearchConnectorException(
                        EasysearchConnectorErrorCode.LIST_INDEX_FAILED,
                        "GET " + endpoint + " response null");
            }
            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                String entity = EntityUtils.toString(response.getEntity());
                return JsonUtils.toList(entity, Map.class).stream()
                        .map(map -> map.get("index").toString())
                        .collect(Collectors.toList());
            } else {
                throw new EasysearchConnectorException(
                        EasysearchConnectorErrorCode.LIST_INDEX_FAILED,
                        String.format(
                                "GET %s response status code=%d",
                                endpoint, response.getStatusLine().getStatusCode()));
            }
        } catch (IOException ex) {
            throw new EasysearchConnectorException(
                    EasysearchConnectorErrorCode.LIST_INDEX_FAILED, ex);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check cluster health (curl /_cluster/health) and reachability of configured hosts
  2. Bypass proxies/LBs to isolate which hop returns null
  3. Retry the listing; transient transport issues resolve after reconnection
  4. Update client/server compatibility (RestClient major version vs server version)

Example fix

// before
List<String> idx = client.listIndex();
// after
List<String> idx;
try { idx = client.listIndex(); } catch (EasysearchConnectorException e) { idx = retryOrEmpty(e); }
Defensive patterns

Strategy: retry

Validate before calling

try (CloseableHttpResponse r = httpClient.execute(new HttpGet(baseUrl + "/_cat/indices?format=json"))) {
  if (r.getStatusLine().getStatusCode() != 200) throw new IllegalStateException("cannot list indices, status=" + r.getStatusLine().getStatusCode());
}

Type guard

boolean valid(Response r) { return r != null && r.getStatusLine() != null; }

Try / catch

try { indices = client.listIndex(); } catch (EasysearchConnectorException e) { indices = backoffRetry(3, Collections.emptyList()); }

Prevention

When it happens

Trigger: Called to list all indices for table discovery; restClient.performRequest returns null instead of a Response.

Common situations: Transport anomalies through proxies, misconfigured client, or a node accepting the connection but returning no response (half-open connection).

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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