{"record":{"id":"20a05b9ef197f5e2","repo":"jd-opensource/joyagent-jdgenie","slug":"collectionname-is-null","errorCode":null,"errorMessage":"collectionName is null!","messagePattern":"collectionName is null!","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"genie-backend/src/main/java/com/jd/genie/service/VectorService.java","lineNumber":128,"sourceCode":"            List<Points.ScoredPoint> scoredPoints = qdrantService.search(req.getCollectionName(), vector, req.getLimit(), filter, req.getPayloads(), req.getTimeout(), TimeUnit.MILLISECONDS, req.getScoreThreshold());\n            return scoredPoints.stream().map(p -> {\n                Map<String, Object> hashMap = new HashMap<>();\n                Map<String, JsonWithInt.Value> payloadMap = p.getPayloadMap();\n                payloadMap.forEach((k, v) -> hashMap.put(k, v.getStringValue()));\n                hashMap.put(\"score\", p.getScore());\n                hashMap.put(\"_id\", p.getId().getUuid());\n                return hashMap;\n            }).collect(Collectors.toList());\n        } catch (Exception e) {\n            log.error(\"vectorRecall error: req:{}\", JSONObject.toJSONString(req), e);\n            throw new RuntimeException(e);\n        }\n    }\n\n    public Boolean saveVector(VectorSaveReq vectorSaveReq) {\n        try {\n            if (StringUtils.isBlank(vectorSaveReq.getCollectionName())) {\n                throw new RuntimeException(\"collectionName is null!\");\n            }\n            if (CollectionUtils.isEmpty(vectorSaveReq.getDataList())) {\n                throw new RuntimeException(\"dataList is null!\");\n            }\n\n            List<String> textList = vectorSaveReq.getDataList().stream().map(VectorSaveReq.VectorData::getEmbeddingText).collect(Collectors.toList());\n            List<List<Float>> vector = embeddingService.getVectorBatch(textList);\n            List<String> idList = vectorSaveReq.getDataList().stream().map(data -> {\n                if (StringUtils.isNotBlank(data.getUuid()) && isUuid(data.getUuid())) {\n                    return data.getUuid();\n                }\n                return UUID.randomUUID().toString();\n            }).collect(Collectors.toList());\n            List<Map<String, Object>> payloads = vectorSaveReq.getDataList().stream().map(VectorSaveReq.VectorData::getPayloads).collect(Collectors.toList());\n            qdrantService.upsertVectorsPayloadTrans(vectorSaveReq.getCollectionName(), idList, vector, payloads);\n            return true;\n        } catch (Exception e) {\n            log.error(\"saveVector error: req:{}\", JSONObject.toJSONString(vectorSaveReq), e);","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/jd-opensource/joyagent-jdgenie/blob/2417e0b8b636d941ad5fb14c59b20dddfef5375d/genie-backend/src/main/java/com/jd/genie/service/VectorService.java#L110-L146","documentation":"VectorService.saveVector throws this when VectorSaveReq.getCollectionName() is blank. Writing vectors requires a target Qdrant collection; a blank name is rejected before any embedding or upsert work is done.","triggerScenarios":"Calling saveVector with a VectorSaveReq where collectionName was not set or set to \"\"/whitespace — e.g., a batch job whose collection-name property failed to load.","commonSituations":"Missing config value for the target collection in the writing pipeline; caller constructs VectorSaveReq programmatically and forgets the field; environment-specific collection names not configured for a new deployment.","solutions":["Set collectionName on VectorSaveReq before calling saveVector (ensure the collection exists in Qdrant).","Ensure the config key supplying the collection name is present in the deployment environment.","Validate at the caller/API boundary so the failure surfaces before embedding costs are incurred.","Confirm the target collection was created (saveVector may not auto-create collections)."],"exampleFix":"// before\nVectorSaveReq saveReq = new VectorSaveReq();\nsaveReq.setDataList(dataList);\nvectorService.saveVector(saveReq);\n// after\nVectorSaveReq saveReq = new VectorSaveReq();\nsaveReq.setCollectionName(\"faq_vectors\");\nsaveReq.setDataList(dataList);\nvectorService.saveVector(saveReq);","handlingStrategy":"validation","validationCode":"// java (caller)\nif (StringUtils.isBlank(saveReq.getCollectionName())) {\n    throw new IllegalArgumentException(\"saveVector requires collectionName\");\n}","typeGuard":"boolean canSave(VectorSaveReq req) {\n    return req != null && StringUtils.isNotBlank(req.getCollectionName());\n}","tryCatchPattern":"try {\n    vectorService.saveVector(saveReq);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"collectionName is null\")) {\n        throw new IllegalArgumentException(\"target vector collection not configured\", e);\n    }\n    throw e;\n}","preventionTips":["Validate collectionName at the API boundary before embedding work starts.","Startup-check that configured collection names exist in Qdrant.","Use constants/config beans instead of ad-hoc strings for collection names."],"tags":["validation","vector-store","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"}