{"record":{"id":"f449aaf118435d69","repo":"prestodb/presto","slug":"nativeplanchecker-connection-error","errorCode":"NATIVEPLANCHECKER_CONNECTION_ERROR","errorMessage":"Error getting native plan checker response","messagePattern":"Error getting native plan checker response","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/nativechecker/NativePlanChecker.java","lineNumber":199,"sourceCode":"    private void runValidation(SimplePlanFragment planFragment)\n    {\n        LOG.debug(\"Starting native plan validation [fragment: %s, root: %s]\", planFragment.getId(), planFragment.getRoot().getId());\n        String requestBodyJson = planFragmentJsonCodec.toJson(planFragment);\n        long start = System.nanoTime();\n\n        try {\n            StringResponse response = httpClient.execute(getSidecarRequest(requestBodyJson), createStringResponseHandler());\n            if (response.getStatusCode() != 200) {\n                NativeSidecarFailureInfo failure = processResponseFailure(response);\n                String message = String.format(\"Error from native plan checker: %s\", firstNonNull(failure.getMessage(), \"Internal error\"));\n                throw new PrestoException(failure::getErrorCode, message, failure.toException());\n            }\n        }\n        catch (RuntimeException e) {\n            if (e instanceof PrestoException) {\n                throw e;\n            }\n            throw new PrestoException(NATIVEPLANCHECKER_CONNECTION_ERROR, \"Error getting native plan checker response\", e);\n        }\n        finally {\n            Duration duration = new Duration(System.nanoTime() - start, TimeUnit.NANOSECONDS);\n            latency.add(duration);\n            LOG.debug(\"Fragment: %s, root: %s, native plan validation latencyMs=%d\", planFragment.getId(), planFragment.getRoot().getId(), duration.toMillis());\n            LOG.debug(\"Native plan validation complete [fragment: %s, root: %s]\", planFragment.getId(), planFragment.getRoot().getId());\n        }\n    }\n\n    private Request getSidecarRequest(String requestBodyJson)\n    {\n        return preparePost()\n                .setUri(getSidecarLocation())\n                .setHeader(CONTENT_TYPE, JSON_UTF_8.toString())\n                .setBodyGenerator(createStaticBodyGenerator(requestBodyJson, UTF_8))\n                .build();\n    }\n","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/nativechecker/NativePlanChecker.java#L181-L217","documentation":"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.","triggerScenarios":"validateFragment -> runValidation where httpClient.execute(...) throws (connection refused, read timeout, DNS failure) or response handling throws a non-PrestoException runtime error.","commonSituations":"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.","solutions":["Check sidecar availability: kubectl get pods / health endpoint for the native sidecar.","Verify the sidecar URI/port configured for the plan checker matches the actual service.","Test connectivity from the coordinator host (curl the sidecar health endpoint).","Look for timeouts under load and increase timeout or scale the sidecar.","Inspect the wrapped cause for the exact transport error."],"exampleFix":"// before\nplan-checker.uri=http://localhost:7777\n// after\nplan-checker.uri=http://native-sidecar.default.svc.cluster.local:8080","handlingStrategy":"retry","validationCode":"// preflight connectivity check\nif (!pingSidecar(planCheckerUri, timeoutSeconds)) { throw new IllegalStateException(\"Plan checker sidecar unreachable: \" + planCheckerUri); }","typeGuard":null,"tryCatchPattern":"try { validateFragment(fragment); }\ncatch (PrestoException e) {\n    if (\"NATIVEPLANCHECKER_CONNECTION_ERROR\".equals(e.getErrorCode().getName()) && attempt < 3) {\n        retryWithBackoff(attempt + 1);\n    } else throw e;\n}","preventionTips":["Deploy sidecar with replica count > 1 and health probes","Use service DNS names, not localhost, in cluster configs","Set realistic HTTP timeouts and retry policies","Alert on coordinator->sidecar connection errors"],"tags":["network","connection","sidecar","native-engine"],"backgroundTag":"connection-refused","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}