{"record":{"id":"2281e2cc6f249edd","repo":"jd-opensource/joyagent-jdgenie","slug":"error-2281e2","errorCode":null,"errorMessage":"集合名称为空！","messagePattern":"集合名称为空！","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"genie-backend/src/main/java/com/jd/genie/service/VectorService.java","lineNumber":45,"sourceCode":"public class VectorService {\n\n    private EmbeddingService embeddingService;\n    private QdrantService qdrantService;\n\n    @Autowired\n    public void setEmbeddingService(EmbeddingService embeddingService) {\n        this.embeddingService = embeddingService;\n    }\n\n    @Autowired\n    public void setQdrantService(QdrantService qdrantService) {\n        this.qdrantService = qdrantService;\n    }\n\n\n    public List<Map<String, Object>> vectorRecall(VectorRecallReq req) {\n        if (StringUtils.isBlank(req.getCollectionName())) {\n            throw new RuntimeException(\"集合名称为空！\");\n        }\n        if (StringUtils.isBlank(req.getQuery())) {\n            throw new RuntimeException(\"查询query为空！\");\n        }\n\n        CompletableFuture<List<Map<String, Object>>> future = null;\n        try {\n            future = CompletableFuture.supplyAsync(() -> recall(req));\n            future.exceptionally(throwable -> null);\n            List<Map<String, Object>> maps = future.get(req.getTimeout(), TimeUnit.MILLISECONDS);\n            if (maps == null || maps.isEmpty()) {\n                log.error(\"vectorRecall empty: req:{}\", JSONObject.toJSONString(req));\n                return new ArrayList<>();\n            }\n            return maps;\n        } catch (Exception e) {\n            log.error(\"vectorRecall error: req:{}\", JSONObject.toJSONString(req), e);\n            if (future != null) {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/jd-opensource/joyagent-jdgenie/blob/2417e0b8b636d941ad5fb14c59b20dddfef5375d/genie-backend/src/main/java/com/jd/genie/service/VectorService.java#L27-L63","documentation":"VectorService.vectorRecall throws this when VectorRecallReq.getCollectionName() is null, empty, or whitespace. The Qdrant vector search requires an explicit collection name to know which vector space to query.","triggerScenarios":"Calling vectorRecall with a VectorRecallReq whose collectionName field was never set (new VectorRecallReq() with only query populated), or set from an upstream config/value that is blank.","commonSituations":"Caller builds the request conditionally and skips setting collectionName; config key for default collection missing so the value resolves to null; refactoring renamed the field but a call site still sets the old property.","solutions":["Set collectionName on the VectorRecallReq before calling vectorRecall.","Add upstream validation at the controller/caller layer to reject requests missing collectionName early.","Check the config/property that supplies the default collection name is present and non-blank.","Improve the exception message to include the trace/request context for easier debugging."],"exampleFix":"// before\nVectorRecallReq req = new VectorRecallReq();\nreq.setQuery(\"how to reset password\");\nvectorService.vectorRecall(req);\n// after\nVectorRecallReq req = new VectorRecallReq();\nreq.setQuery(\"how to reset password\");\nreq.setCollectionName(\"faq_vectors\");\nAssert.hasText(req.getCollectionName(), \"collectionName must be set\");\nvectorService.vectorRecall(req);","handlingStrategy":"validation","validationCode":"// java (caller)\nif (req == null || StringUtils.isBlank(req.getCollectionName())) {\n    throw new IllegalArgumentException(\"collectionName must be provided\");\n}","typeGuard":"boolean hasCollection(VectorRecallReq req) {\n    return req != null && StringUtils.isNotBlank(req.getCollectionName());\n}","tryCatchPattern":"try {\n    return vectorService.vectorRecall(req);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"集合名称为空\")) {\n        throw new IllegalArgumentException(\"vectorRecall requires collectionName\", e);\n    }\n    throw e;\n}","preventionTips":["Use a builder/factory that requires collectionName at construction time.","Externalize the default collection name in config with a startup check.","Add unit tests covering requests missing collectionName."],"tags":["validation","vector-search","java","missing-argument"],"backgroundTag":"missing-required-argument","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"}