jd-opensource/joyagent-jdgenie · error · RuntimeException

collectionName is null!

Error message

collectionName is null!

What it means

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.

Solutions

  1. Set collectionName on VectorSaveReq before calling saveVector (ensure the collection exists in Qdrant).
  2. Ensure the config key supplying the collection name is present in the deployment environment.
  3. Validate at the caller/API boundary so the failure surfaces before embedding costs are incurred.
  4. Confirm the target collection was created (saveVector may not auto-create collections).

Example fix

// before
VectorSaveReq saveReq = new VectorSaveReq();
saveReq.setDataList(dataList);
vectorService.saveVector(saveReq);
// after
VectorSaveReq saveReq = new VectorSaveReq();
saveReq.setCollectionName("faq_vectors");
saveReq.setDataList(dataList);
vectorService.saveVector(saveReq);
Defensive patterns

Strategy: validation

Validate before calling

// java (caller)
if (StringUtils.isBlank(saveReq.getCollectionName())) {
    throw new IllegalArgumentException("saveVector requires collectionName");
}

Type guard

boolean canSave(VectorSaveReq req) {
    return req != null && StringUtils.isNotBlank(req.getCollectionName());
}

Try / catch

try {
    vectorService.saveVector(saveReq);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("collectionName is null")) {
        throw new IllegalArgumentException("target vector collection not configured", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jd-opensource/joyagent-jdgenie@2417e0b8b6 (2026-09-08). Data as JSON: /api/errors/20a05b9ef197f5e2. Report an issue: GitHub.

Appendix: source

Thrown at genie-backend/src/main/java/com/jd/genie/service/VectorService.java:128

            List<Points.ScoredPoint> scoredPoints = qdrantService.search(req.getCollectionName(), vector, req.getLimit(), filter, req.getPayloads(), req.getTimeout(), TimeUnit.MILLISECONDS, req.getScoreThreshold());
            return scoredPoints.stream().map(p -> {
                Map<String, Object> hashMap = new HashMap<>();
                Map<String, JsonWithInt.Value> payloadMap = p.getPayloadMap();
                payloadMap.forEach((k, v) -> hashMap.put(k, v.getStringValue()));
                hashMap.put("score", p.getScore());
                hashMap.put("_id", p.getId().getUuid());
                return hashMap;
            }).collect(Collectors.toList());
        } catch (Exception e) {
            log.error("vectorRecall error: req:{}", JSONObject.toJSONString(req), e);
            throw new RuntimeException(e);
        }
    }

    public Boolean saveVector(VectorSaveReq vectorSaveReq) {
        try {
            if (StringUtils.isBlank(vectorSaveReq.getCollectionName())) {
                throw new RuntimeException("collectionName is null!");
            }
            if (CollectionUtils.isEmpty(vectorSaveReq.getDataList())) {
                throw new RuntimeException("dataList is null!");
            }

            List<String> textList = vectorSaveReq.getDataList().stream().map(VectorSaveReq.VectorData::getEmbeddingText).collect(Collectors.toList());
            List<List<Float>> vector = embeddingService.getVectorBatch(textList);
            List<String> idList = vectorSaveReq.getDataList().stream().map(data -> {
                if (StringUtils.isNotBlank(data.getUuid()) && isUuid(data.getUuid())) {
                    return data.getUuid();
                }
                return UUID.randomUUID().toString();
            }).collect(Collectors.toList());
            List<Map<String, Object>> payloads = vectorSaveReq.getDataList().stream().map(VectorSaveReq.VectorData::getPayloads).collect(Collectors.toList());
            qdrantService.upsertVectorsPayloadTrans(vectorSaveReq.getCollectionName(), idList, vector, payloads);
            return true;
        } catch (Exception e) {
            log.error("saveVector error: req:{}", JSONObject.toJSONString(vectorSaveReq), e);

View on GitHub (pinned to 2417e0b8b6)