{"record":{"id":"39692419a25286cd","repo":"jd-opensource/joyagent-jdgenie","slug":"id","errorCode":null,"errorMessage":"向量id集合为空！","messagePattern":"向量id集合为空！","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"genie-backend/src/main/java/com/jd/genie/service/QdrantService.java","lineNumber":169,"sourceCode":"        for (int i = 0; i < vectors.size(); i++) {\n            Points.PointStruct pointStruct = Points.PointStruct.newBuilder()\n                    .setId(id(UUID.randomUUID()))\n                    .setVectors(vectors(vectors.get(i)))\n                    .putAllPayload(payloads.get(i))\n                    .build();\n            pointStructList.add(pointStruct);\n        }\n\n        return client.upsertAsync(collectionName, pointStructList).get();\n    }\n\n    public Points.UpdateResult upsertVectors(String collectionName, List<String> idList, List<List<Float>> vectors, List<Map<String, JsonWithInt.Value>> payloads) throws ExecutionException, InterruptedException {\n        if (StringUtils.isBlank(collectionName)) {\n            throw new RuntimeException(\"集合名为空！\");\n        }\n\n        if (CollectionUtils.isEmpty(idList)) {\n            throw new RuntimeException(\"向量id集合为空！\");\n        }\n\n        if (CollectionUtils.isEmpty(vectors)) {\n            throw new RuntimeException(\"向量集合为空！\");\n        }\n\n        if (CollectionUtils.isEmpty(payloads)) {\n            throw new RuntimeException(\"元数据集合为空！\");\n        }\n\n        if (vectors.size() != payloads.size()) {\n            throw new RuntimeException(\"向量集合大小与元数据集合大小不一致，vectorSize：\" + vectors.size() + \"，payloadSize：\" + payloads.size());\n        }\n\n        List<Points.PointStruct> pointStructList = new ArrayList<>();\n        for (int i = 0; i < vectors.size(); i++) {\n            Points.PointStruct pointStruct = Points.PointStruct.newBuilder()\n                    .setId(id(UUID.fromString(idList.get(i))))","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/jd-opensource/joyagent-jdgenie/blob/2417e0b8b636d941ad5fb14c59b20dddfef5375d/genie-backend/src/main/java/com/jd/genie/service/QdrantService.java#L151-L187","documentation":"The id-bearing upsertVectors overload requires an explicit point ID per vector; a null/empty idList leaves points without deterministic IDs, so it throws RuntimeException(\"向量id集合为空！\") (vector id collection is empty).","triggerScenarios":"Calling upsertVectors(collectionName, idList, vectors, payloads) with an empty/null idList while vectors are present — the ID source query returned nothing or IDs were never collected.","commonSituations":"Upstream ID lookup returned empty; developer assumed IDs optional and used this overload instead of the id-less one; batch assembly forgot to add IDs.","solutions":["Populate idList with one ID per vector (UUID or business key)","If you do not need explicit IDs, switch to the 3-arg upsertVectors(collectionName, vectors, payloads) which auto-generates UUIDs","Check why the ID source list is empty upstream"],"exampleFix":"// before\nqdrantService.upsertVectors(collection, new ArrayList<>(), vectors, payloads);\n// after\nList<String> idList = vectors.stream().map(v -> UUID.randomUUID().toString()).collect(toList());\nqdrantService.upsertVectors(collection, idList, vectors, payloads);","handlingStrategy":"validation","validationCode":"if (idList == null || idList.isEmpty() || idList.size() != vectors.size()) {\n    throw new IllegalStateException(\"idList must contain one id per vector\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    qdrantService.upsertVectors(collectionName, idList, vectors, payloads);\n} catch (RuntimeException e) {\n    if (\"向量id集合为空！\".equals(e.getMessage())) {\n        log.error(\"no point ids supplied for id-based upsert\");\n    } else throw e;\n}","preventionTips":["Use this overload only when you have deterministic IDs; otherwise use the id-less overload","Generate IDs (UUID or business key) in the same loop as vectors","Validate idList.size() == vectors.size() before the call"],"tags":["java","qdrant","vector-database","validation"],"backgroundTag":"empty-required-field","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"}