prestodb/presto · error · PrestoException
PROMETHEUS_UNKNOWN_ERROR
PROMETHEUS_UNKNOWN_ERROR
Error message
Error reading metrics
What it means
The generic catch (IOException e) in fetchUri wraps any non-SSL IO failure while executing the HTTP request or reading the response body and rethrows it as PROMETHEUS_UNKNOWN_ERROR with the message 'Error reading metrics'. It is the catch-all for connection failures, socket timeouts, and body-read errors against the Prometheus API.
Source
Thrown at presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusClient.java:202
}
}
else {
response = httpClient.newCall(requestBuilder.build()).execute();
if (response.isSuccessful() && response.body() != null) {
return response.body().bytes();
}
}
}
catch (SSLHandshakeException e) {
throw new PrestoException(PROMETHEUS_SECURE_COMMUNICATION_ERROR, "An SSL handshake error occurred while establishing a secure connection. Try the following measures to resolve the error:\n\n" + "- Upload a valid SSL certificate for authentication\n- Verify the expiration status of the uploaded certificate.\n- If you are connecting with SSL, enable SSL on both ends of the connection.\n", e);
}
catch (SSLPeerUnverifiedException e) {
throw new PrestoException(PROMETHEUS_SECURE_COMMUNICATION_ERROR, "Peer verification failed. These measures might resolve the issue \n" +
"- Add correct Hostname in the SSL certificate's SAN list \n" +
"- The certificate chain might be incomplete. Check your SSL certificate\n", e);
}
catch (IOException e) {
throw new PrestoException(PROMETHEUS_UNKNOWN_ERROR, "Error reading metrics", e);
}
catch (NoSuchAlgorithmException e) {
throw new PrestoException(PROMETHEUS_SECURE_COMMUNICATION_ERROR, "Requested cryptographic algorithm is not available", e);
}
catch (KeyStoreException e) {
throw new PrestoException(PROMETHEUS_SECURE_COMMUNICATION_ERROR, "Keystore operation error", e);
}
catch (KeyManagementException e) {
throw new PrestoException(PROMETHEUS_SECURE_COMMUNICATION_ERROR, "Key management operation error", e);
}
throw new PrestoException(PROMETHEUS_UNKNOWN_ERROR, "Bad response " + response.code() + response.message());
}
private Optional<String> getBearerAuthInfoFromFile()
{
return bearerTokenFile.map(tokenFileName -> {
try {View on GitHub (pinned to 55bb57d202)
Solutions
- Confirm the Prometheus URL is reachable from the Presto coordinator: curl the connection-url + '/api/v1/query' path
- Check Prometheus server logs and health endpoint (/../../-/healthy) for crashes or overload
- Increase query timeouts (both Presto and Prometheus) and reduce the time range of the query
- Inspect the wrapped cause (PrestoException's cause) for the concrete IOException — connect refused vs timeout vs reset points to different fixes
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight check that Prometheus is reachable from the coordinator curl -fsS --max-time 5 http://prometheus.example.com:9090/-/healthy
Try / catch
catch (PrestoException e) {
if (PROMETHEUS_UNKNOWN_ERROR.equals(e.getErrorCode().getName()) && "Error reading metrics".equals(e.getMessage())) {
// transient IO: backoff and retry, or surface connectivity guidance
retryWithBackoff();
} else throw e;
} Prevention
- Monitor Prometheus health endpoint and alert on unreachability
- Open firewall/NetworkPolicy paths from coordinator to Prometheus before catalog setup
- Keep queries time-bounded so responses don't time out or truncate
- Log and inspect the cause chain to distinguish refused vs timeout vs reset
When it happens
Trigger: fetchUri (via fetchMetrics/PrometheusRecordSet) hitting a refused connection, DNS failure, connect/read timeout, or stream truncation while downloading query results from the Prometheus endpoint.
Common situations: Prometheus down or restarted; wrong host/port in connection-url; firewall or NetworkPolicy blocking coordinator→Prometheus traffic; Prometheus timing out on expensive instant/range queries; large query responses dropped.
Related errors
- Failed reading response from remote Presto server
- Error fetching next (attempts: %s, duration: %s)
- INVALID_ARGUMENTS
- PINOT_HTTP_ERROR
- PROMETHEUS_TABLES_METRICS_RETRIEVE_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/67b68ecad3ada855.
Report an issue: GitHub.