alibaba/Sentinel · error · EurekaMetadataFetchException
Can't get any data
Error message
Can't get any data
What it means
EurekaDataSource fetches Sentinel rule metadata by querying the Eureka registry (listApps) and reading each instance's metadata map. If every attempt to fetch/parse instance metadata fails (exceptions are caught, logged, connection disconnected, loop continues), the method finishes by throwing the checked EurekaMetadataFetchException('Can't get any data').
Source
Thrown at sentinel-extension/sentinel-datasource-eureka/src/main/java/com/alibaba/csp/sentinel/datasource/eureka/EurekaDataSource.java:175
} catch (Exception e) {
try {
if (conn != null) {
RecordLog.warn("[EurekaDataSource] Warn: failed to request " + conn.getURL() + " from "
+ InetAddress.getByName(conn.getURL().getHost()).getHostAddress(), e);
}
} catch (Exception e1) {
RecordLog.warn("[EurekaDataSource] Warn: failed to request ", e1);
//ignore
}
RecordLog.warn("[EurekaDataSource] Warn: failed to request,retrying on another server if available");
} finally {
if (conn != null) {
conn.disconnect();
}
}
}
throw new EurekaMetadataFetchException("Can't get any data");
}
public static class EurekaMetadataFetchException extends Exception {
public EurekaMetadataFetchException(String message) {
super(message);
}
}
private String toString(InputStream input) throws IOException {
if (input == null) {
return null;
}
InputStreamReader inputStreamReader = new InputStreamReader(input, "utf-8");
CharArrayWriter sw = new CharArrayWriter();
copy(inputStreamReader, sw);
return sw.toString();
}View on GitHub (pinned to a3f40ba8e9)
Solutions
- Confirm the target application is registered in Eureka and has the Sentinel rule metadata key set in its instance metadata.
- Verify the Eureka server URL(s) configured on EurekaDataSource and that the server is reachable from the application.
- Check logs above the exception — each failed attempt logs '[EurekaDataSource] Warn: failed to request' with the underlying HTTP error that pinpoints the cause.
Example fix
// before
EurekaDataSource<List<FlowRule>> ds = new EurekaDataSource<>(
"http://wrong-eureka:8761/eureka", "not-registered-app", "missing-key", parser);
ds.loadConfig(); // EurekaMetadataFetchException: Can't get any data
// after
// app registered + metadata key present:
// eureka.instance.metadata-map.sentinel.rules={...}
EurekaDataSource<List<FlowRule>> ds = new EurekaDataSource<>(
"http://eureka:8761/eureka", "my-app", "sentinel.rules", parser);
ds.loadConfig(); Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: confirm the app is registered with Sentinel metadata
Application app = eurekaClient.getApplication(appName);
if (app == null || app.getInstances().isEmpty()
|| app.getInstances().get(0).getMetadata().get(ruleKey) == null) {
throw new IllegalStateException(
"App " + appName + " not registered in Eureka or missing metadata key " + ruleKey);
} Try / catch
int attempts = 3;
while (true) {
try {
return ds.readSource();
} catch (EurekaMetadataFetchException e) {
if (--attempts <= 0) {
throw new IllegalStateException("Eureka metadata fetch failed after retries", e);
}
// backoff before retry; registration may still be propagating
Thread.sleep(2000L * (4 - attempts));
}
} Prevention
- Ensure services publish rule metadata (eureka.instance.metadata-map.<key>) at registration time.
- Retry with backoff on first load — Eureka registration/read propagation can lag app startup.
- Log and inspect the per-attempt warnings that precede the final exception; they carry the real HTTP error.
When it happens
Trigger: EurekaDataSource.readSource() when the Eureka server list returns no reachable apps, the target service has no instances with the 'sentinel.rules' metadata key, or all HTTP fetches throw (timeout, 404, auth failure).
Common situations: Wrong eurekaClient serviceUrl; the monitored app not yet registered in Eureka (cold start); metadata key not published by the service; eureka server requiring auth that the datasource does not supply.
Related errors
- Consul has not been initialized or error occurred
- parser can't be null
- recommendRefreshMs must > 0, but {} get
- bufSize must between (0, ${MAX_SIZE}], but ${bufSize} get
- Size of file <%s> exceeds the bufSize (%d): %d
AI-assisted analysis of alibaba/Sentinel@a3f40ba8e9 (2026-08-14).
Data as JSON: /api/errors/9b8cd29f8b938057.
Report an issue: GitHub.