jd-opensource/joyagent-jdgenie · warning · RuntimeException
tableRag result data is empty
Error message
tableRag result data is empty
What it means
Thrown by TableRagService.tableRag when the upstream returned code 200 but its data list is null or empty, meaning no matching table schema records were recalled for the query. The service call succeeded but produced no usable results.
Solutions
- Broaden or rephrase the query text so recall can match known table schemas.
- Verify the target tables are registered and indexed in the data agent (data sync job status).
- Check whether request filters (keywords, table scope) are unintentionally excluding all candidates.
- Decide explicitly how callers should treat an empty recall (fallback path vs. hard failure) and catch this case separately.
Example fix
// before
if (CollectionUtils.isEmpty(data)) {
throw new RuntimeException("tableRag result data is empty");
}
// after
if (CollectionUtils.isEmpty(data)) {
log.warn("tableRag empty data, traceId={}, req={}", req.getTraceId(), JSONObject.toJSONString(req));
return Collections.emptyList(); // or throw with query context
} Defensive patterns
Strategy: fallback
Validate before calling
// caller-side: if recall may legitimately be empty, treat empty as a normal outcome
if (data == null || data.isEmpty()) { return fallbackSearch(query); } Try / catch
try {
return tableRagService.tableRag(req);
} catch (RuntimeException e) {
if ("tableRag result data is empty".equals(e.getMessage())) {
return Collections.emptyList(); // or keyword-based fallback
}
throw e;
} Prevention
- Keep table metadata ingestion/sync jobs healthy so the index is populated.
- Prefer broadening query terms instead of failing hard on zero recall.
- Track empty-recall rates per query type to detect index gaps.
When it happens
Trigger: tableRagResult.getCode() == 200 and CollectionUtils.isEmpty(tableRagResult.getData()) — i.e., the recall query matched no table schemas in the data agent's index.
Common situations: Query text too specific or containing terms absent from indexed tables; table metadata not yet ingested/synced into the data agent; over-restrictive filters in the request; the queried tenant/workspace has no registered tables.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Tool execution failed: " + error
- Tool execution result is null
- Input must be a Map
- Command is required
- Unknown command: " + command
AI-assisted analysis of jd-opensource/joyagent-jdgenie@2417e0b8b6 (2026-09-08).
Data as JSON: /api/errors/2c207dbfbc26f9fd.
Report an issue: GitHub.
Appendix: source
Thrown at genie-backend/src/main/java/com/jd/genie/service/TableRagService.java:52
}
String res;
try {
res = OkHttpUtil.postJsonBody(dataAgentConfig.getAgentUrl() + TABLE_RAG_URL, null, JSONObject.toJSONString(req));
} catch (Exception e) {
log.warn("{},{} tableRag server error,retry:{}",req.getTraceId(),req.getRequestId(), e.getMessage());
res = OkHttpUtil.postJsonBody(dataAgentConfig.getAgentUrl() + TABLE_RAG_URL, null, JSONObject.toJSONString(req));
}
log.info("{},{} tableRag result:{}", req.getTraceId(),req.getRequestId(),res);
TableRagResult tableRagResult = JSONObject.parseObject(res, TableRagResult.class);
if (tableRagResult == null || tableRagResult.getCode() == null) {
throw new RuntimeException("tableRag result is null");
}
if (tableRagResult.getCode() != 200) {
throw new RuntimeException("tableRag server return error");
}
List<TableRagResult.TableRagData> data = tableRagResult.getData();
if (CollectionUtils.isEmpty(data)) {
throw new RuntimeException("tableRag result data is empty");
}
return data.stream()
.filter(Objects::nonNull)
.map(TableRagResult.TableRagData::getSchemaList)
.filter(CollectionUtils::isNotEmpty)
.flatMap(Collection::stream)
.collect(Collectors.toList());
}
}
View on GitHub (pinned to 2417e0b8b6)