{"record":{"id":"2c207dbfbc26f9fd","repo":"jd-opensource/joyagent-jdgenie","slug":"tablerag-result-data-is-empty","errorCode":null,"errorMessage":"tableRag result data is empty","messagePattern":"tableRag result data is empty","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"genie-backend/src/main/java/com/jd/genie/service/TableRagService.java","lineNumber":52,"sourceCode":"        }\n        String res;\n        try {\n            res = OkHttpUtil.postJsonBody(dataAgentConfig.getAgentUrl() + TABLE_RAG_URL, null, JSONObject.toJSONString(req));\n        } catch (Exception e) {\n            log.warn(\"{},{} tableRag server error,retry:{}\",req.getTraceId(),req.getRequestId(), e.getMessage());\n            res = OkHttpUtil.postJsonBody(dataAgentConfig.getAgentUrl() + TABLE_RAG_URL, null, JSONObject.toJSONString(req));\n        }\n        log.info(\"{},{} tableRag result:{}\", req.getTraceId(),req.getRequestId(),res);\n        TableRagResult tableRagResult = JSONObject.parseObject(res, TableRagResult.class);\n        if (tableRagResult == null || tableRagResult.getCode() == null) {\n            throw new RuntimeException(\"tableRag result is null\");\n        }\n        if (tableRagResult.getCode() != 200) {\n            throw new RuntimeException(\"tableRag server return error\");\n        }\n        List<TableRagResult.TableRagData> data = tableRagResult.getData();\n        if (CollectionUtils.isEmpty(data)) {\n            throw new RuntimeException(\"tableRag result data is empty\");\n        }\n        return data.stream()\n                .filter(Objects::nonNull)\n                .map(TableRagResult.TableRagData::getSchemaList)\n                .filter(CollectionUtils::isNotEmpty)\n                .flatMap(Collection::stream)\n                .collect(Collectors.toList());\n    }\n}\n","sourceCodeStart":34,"sourceCodeEnd":62,"githubUrl":"https://github.com/jd-opensource/joyagent-jdgenie/blob/2417e0b8b636d941ad5fb14c59b20dddfef5375d/genie-backend/src/main/java/com/jd/genie/service/TableRagService.java#L34-L62","documentation":"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.","triggerScenarios":"tableRagResult.getCode() == 200 and CollectionUtils.isEmpty(tableRagResult.getData()) — i.e., the recall query matched no table schemas in the data agent's index.","commonSituations":"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.","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."],"exampleFix":"// before\nif (CollectionUtils.isEmpty(data)) {\n    throw new RuntimeException(\"tableRag result data is empty\");\n}\n// after\nif (CollectionUtils.isEmpty(data)) {\n    log.warn(\"tableRag empty data, traceId={}, req={}\", req.getTraceId(), JSONObject.toJSONString(req));\n    return Collections.emptyList(); // or throw with query context\n}","handlingStrategy":"fallback","validationCode":"// caller-side: if recall may legitimately be empty, treat empty as a normal outcome\nif (data == null || data.isEmpty()) { return fallbackSearch(query); }","typeGuard":null,"tryCatchPattern":"try {\n    return tableRagService.tableRag(req);\n} catch (RuntimeException e) {\n    if (\"tableRag result data is empty\".equals(e.getMessage())) {\n        return Collections.emptyList(); // or keyword-based fallback\n    }\n    throw e;\n}","preventionTips":["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."],"tags":["empty-result","recall","search","java"],"backgroundTag":"empty-result-set","analyzedSha":"2417e0b8b636d941ad5fb14c59b20dddfef5375d","analyzedAt":"2026-09-08T11:28:19.414Z","contentChangedAt":"2026-09-08T11:28:19.414Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}