jd-opensource/joyagent-jdgenie · error · RuntimeException
tableRag server return error
Error message
tableRag server return error
What it means
Thrown by TableRagService.tableRag when the remote table-RAG service responded with a parseable envelope whose code field is not 200. The service is reachable but reported a business-level failure for the request.
Solutions
- Log tableRagResult.getMessage()/body alongside code to learn the actual upstream failure reason.
- Inspect data-agent server logs using req.getTraceId()/req.getRequestId() to find the root cause.
- Validate the request payload (query text, table filters) against the data-agent API contract.
- Add specific handling/retry for transient upstream codes (e.g., 429/503) instead of a generic RuntimeException.
Example fix
// before
if (tableRagResult.getCode() != 200) {
throw new RuntimeException("tableRag server return error");
}
// after
if (tableRagResult.getCode() != 200) {
throw new RuntimeException("tableRag server return error, code=" + tableRagResult.getCode()
+ ", msg=" + tableRagResult.getMessage() + ", traceId=" + req.getTraceId());
} Defensive patterns
Strategy: retry
Validate before calling
// preflight: check upstream reachable and expecting 200 envelope
// curl -s -o /dev/null -w '%{http_code}' $AGENT_URL/tableRag Try / catch
try {
List<TableRagResult.TableRagData> data = tableRagService.tableRag(req);
} catch (RuntimeException e) {
if ("tableRag server return error".equals(e.getMessage())) {
// inspect data-agent logs via traceId; retry only for transient codes
}
throw e;
} Prevention
- Propagate the upstream code/message into your own exception for diagnosability.
- Correlate with data-agent logs using traceId/requestId.
- Add retry-with-backoff only for transient upstream codes (429/503).
When it happens
Trigger: POST to dataAgentConfig.getAgentUrl() + TABLE_RAG_URL succeeds and returns JSON like {"code":500,...}; any non-200 business code from the data agent triggers this exact branch.
Common situations: Malformed or oversized query sent to the data agent; data-agent internal error (invalid collection, service overload); API contract change where the agent now returns 4xx/5xx-style codes in the body; wrong environment endpoint that rejects the request.
Related errors
- tableRag result is null
- 调用接口" + url + "失败:" + response.message()
- 向量生成失败!
- 返回结果为空!
- Tool execution failed: " + error
AI-assisted analysis of jd-opensource/joyagent-jdgenie@2417e0b8b6 (2026-09-08).
Data as JSON: /api/errors/71b8c5de99cba809.
Report an issue: GitHub.
Appendix: source
Thrown at genie-backend/src/main/java/com/jd/genie/service/TableRagService.java:48
public List<ChatSchemaDto> tableRag(NL2SQLReq req) throws IOException {
if (!dataAgentConfig.getEsConfig().getEnable() && !dataAgentConfig.getQdrantConfig().getEnable()) {
log.info("{},{} 未开启向量和es,不进行tableRag",req.getTraceId(),req.getRequestId());
return new ArrayList<>();
}
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)