prestodb/presto · error · PrestoException

NATIVEPLANCHECKER_CONNECTION_ERROR

NATIVEPLANCHECKER_CONNECTION_ERROR

Error message

Error getting native plan checker response

What it means

Thrown when the HTTP call to the native plan checker itself fails with an unexpected RuntimeException (any exception that is not already a PrestoException). It wraps transport-level problems — connection refused, timeouts, connection reset — in a dedicated NATIVEPLANCHECKER_CONNECTION_ERROR code.

Source

Thrown at presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/nativechecker/NativePlanChecker.java:199

    private void runValidation(SimplePlanFragment planFragment)
    {
        LOG.debug("Starting native plan validation [fragment: %s, root: %s]", planFragment.getId(), planFragment.getRoot().getId());
        String requestBodyJson = planFragmentJsonCodec.toJson(planFragment);
        long start = System.nanoTime();

        try {
            StringResponse response = httpClient.execute(getSidecarRequest(requestBodyJson), createStringResponseHandler());
            if (response.getStatusCode() != 200) {
                NativeSidecarFailureInfo failure = processResponseFailure(response);
                String message = String.format("Error from native plan checker: %s", firstNonNull(failure.getMessage(), "Internal error"));
                throw new PrestoException(failure::getErrorCode, message, failure.toException());
            }
        }
        catch (RuntimeException e) {
            if (e instanceof PrestoException) {
                throw e;
            }
            throw new PrestoException(NATIVEPLANCHECKER_CONNECTION_ERROR, "Error getting native plan checker response", e);
        }
        finally {
            Duration duration = new Duration(System.nanoTime() - start, TimeUnit.NANOSECONDS);
            latency.add(duration);
            LOG.debug("Fragment: %s, root: %s, native plan validation latencyMs=%d", planFragment.getId(), planFragment.getRoot().getId(), duration.toMillis());
            LOG.debug("Native plan validation complete [fragment: %s, root: %s]", planFragment.getId(), planFragment.getRoot().getId());
        }
    }

    private Request getSidecarRequest(String requestBodyJson)
    {
        return preparePost()
                .setUri(getSidecarLocation())
                .setHeader(CONTENT_TYPE, JSON_UTF_8.toString())
                .setBodyGenerator(createStaticBodyGenerator(requestBodyJson, UTF_8))
                .build();
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check sidecar availability: kubectl get pods / health endpoint for the native sidecar.
  2. Verify the sidecar URI/port configured for the plan checker matches the actual service.
  3. Test connectivity from the coordinator host (curl the sidecar health endpoint).
  4. Look for timeouts under load and increase timeout or scale the sidecar.
  5. Inspect the wrapped cause for the exact transport error.

Example fix

// before
plan-checker.uri=http://localhost:7777
// after
plan-checker.uri=http://native-sidecar.default.svc.cluster.local:8080
Defensive patterns

Strategy: retry

Validate before calling

// preflight connectivity check
if (!pingSidecar(planCheckerUri, timeoutSeconds)) { throw new IllegalStateException("Plan checker sidecar unreachable: " + planCheckerUri); }

Try / catch

try { validateFragment(fragment); }
catch (PrestoException e) {
    if ("NATIVEPLANCHECKER_CONNECTION_ERROR".equals(e.getErrorCode().getName()) && attempt < 3) {
        retryWithBackoff(attempt + 1);
    } else throw e;
}

Prevention

When it happens

Trigger: validateFragment -> runValidation where httpClient.execute(...) throws (connection refused, read timeout, DNS failure) or response handling throws a non-PrestoException runtime error.

Common situations: Sidecar service down or scaled to zero; wrong sidecar port/URI in config; network policy or firewall blocking coordinator->sidecar traffic; sidecar overloaded causing timeouts.

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 prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/f449aaf118435d69. Report an issue: GitHub.