jd-opensource/joyagent-jdgenie · error · RuntimeException

集合名为空!

Error message

集合名为空!

What it means

The first upsertVectors(collectionName, vectors, payloads) overload validates the collection name before building PointStructs. A blank collectionName makes the upsert impossible to address, so it throws RuntimeException("集合名为空!") (collection name is empty).

Solutions

  1. Trace the caller and confirm where the blank name originates
  2. Configure the collection name (config property or env var) and pass it explicitly
  3. Add a startup-time validation so a missing collection config fails fast

Example fix

// before
qdrantService.upsertVectors(null, vectors, payloads);
// after
if (StringUtils.isBlank(collectionName)) {
    throw new IllegalStateException("qdrant collectionName is not configured");
}
qdrantService.upsertVectors(collectionName, vectors, payloads);
Defensive patterns

Strategy: validation

Validate before calling

if (collectionName == null || collectionName.isBlank()) {
    throw new IllegalStateException("configure qdrant collection name before upsert");
}

Try / catch

try {
    qdrantService.upsertVectors(collectionName, vectors, payloads);
} catch (RuntimeException e) {
    if ("集合名为空!".equals(e.getMessage())) {
        log.error("qdrant collection name not configured");
    } else throw e;
}

Prevention

When it happens

Trigger: Calling upsertVectors with null/blank collectionName — usually a missing config property or an unset variable computed upstream.

Common situations: Missing qdrant collection setting in config file or environment; collection name constructed from an empty tenant/id field; refactoring left a caller passing null.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at genie-backend/src/main/java/com/jd/genie/service/QdrantService.java:135

                        .setCollectionName(collectionName)
                        .setFilter(filter)
                        .setOffset(offset)
                        .setLimit(size)
                        .setWithPayload(enable(true))
                        .build()).get();
    }

    public void deletePointsSync(String collectionName, List<Points.PointId> ids) throws ExecutionException, InterruptedException {
        client.deleteAsync(collectionName, ids).get();
    }

    public void deleteByFilterSync(String collectionName, Points.Filter filter) throws ExecutionException, InterruptedException {
        client.deleteAsync(collectionName, filter).get();
    }

    public Points.UpdateResult upsertVectors(String collectionName, List<List<Float>> vectors, List<Map<String, JsonWithInt.Value>> payloads) throws ExecutionException, InterruptedException {
        if (StringUtils.isBlank(collectionName)) {
            throw new RuntimeException("集合名为空!");
        }

        if (CollectionUtils.isEmpty(vectors)) {
            throw new RuntimeException("向量集合为空!");
        }

        if (CollectionUtils.isEmpty(payloads)) {
            throw new RuntimeException("元数据集合为空!");
        }

        if (vectors.size() != payloads.size()) {
            throw new RuntimeException("向量集合大小与元数据集合大小不一致,vectorSize:" + vectors.size() + ",payloadSize:" + payloads.size());
        }

        List<Points.PointStruct> pointStructList = new ArrayList<>();
        for (int i = 0; i < vectors.size(); i++) {
            Points.PointStruct pointStruct = Points.PointStruct.newBuilder()
                    .setId(id(UUID.randomUUID()))

View on GitHub (pinned to 2417e0b8b6)