jd-opensource/joyagent-jdgenie · error · IllegalArgumentException

collectionName is empty

Error message

collectionName is empty

What it means

QdrantService.search validates its arguments before issuing a gRPC SearchPoints request to the Qdrant vector database. A blank collectionName cannot address any collection, so it throws IllegalArgumentException("collectionName is empty") immediately.

Solutions

  1. Log and inspect the caller to find where the blank collectionName comes from
  2. Set the collection name in configuration (e.g. qdrant.collection) and inject it
  3. Add an upfront guard/default so callers never pass a blank name

Example fix

// before
qdrantService.search(config.getCollectionName(), vector, 10, null, null, 5L, TimeUnit.SECONDS, 0.7f);
// after
Assert.hasText(config.getCollectionName(), "qdrant collection name must be configured");
qdrantService.search(config.getCollectionName(), vector, 10, null, null, 5L, TimeUnit.SECONDS, 0.7f);
Defensive patterns

Strategy: validation

Validate before calling

if (collectionName == null || collectionName.isBlank()) {
    throw new IllegalArgumentException("collectionName must be non-blank");
}

Try / catch

try {
    List<Points.ScoredPoint> hits = qdrantService.search(collectionName, vector, limit, filter, payloads, timeout, unit, scoreThreshold);
} catch (IllegalArgumentException e) {
    log.error("Invalid qdrant search argument: {}", e.getMessage());
    return Collections.emptyList();
}

Prevention

When it happens

Trigger: Calling search(collectionName, vector, ...) with null, empty, or whitespace-only collectionName — typically a null/blank config property or a value derived from an unset upstream variable.

Common situations: Missing qdrant collection config key in application.yml; environment variable not set in the deployment; code path constructs collection name by concatenation that yields empty string.

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/1bf2722f3ded3849. Report an issue: GitHub.

Appendix: source

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

        if (client == null) {
            if (StringUtils.isNotBlank(dataAgentConfig.getQdrantConfig().getApiKey())) {
                client = new QdrantClient(QdrantGrpcClient.newBuilder(dataAgentConfig.getQdrantConfig().getHost(), dataAgentConfig.getQdrantConfig().getPort(), false).withApiKey(dataAgentConfig.getQdrantConfig().getApiKey()).build());
            } else {
                client = new QdrantClient(QdrantGrpcClient.newBuilder(dataAgentConfig.getQdrantConfig().getHost(), dataAgentConfig.getQdrantConfig().getPort(), false).build());
            }
        }
    }

    @Override
    public void destroy() {
        if (client != null) {
            client.close();
        }
    }

    public List<Points.ScoredPoint> search(String collectionName, List<Float> vector, int limit, Points.Filter filter, List<String> payloads, Long timeout, TimeUnit timeUnit, Float scoreThreshold) throws ExecutionException, InterruptedException, TimeoutException {
        if (StringUtils.isBlank(collectionName)) {
            throw new IllegalArgumentException("collectionName is empty");
        }
        if (CollectionUtils.isEmpty(vector)) {
            throw new IllegalArgumentException("vector is empty");
        }
        Points.SearchPoints.Builder requestBuilder = Points.SearchPoints.newBuilder();
        requestBuilder.setCollectionName(collectionName);
        requestBuilder.addAllVector(vector);
        requestBuilder.setLimit(Math.min(limit, maxLimitSize));
        if (Objects.nonNull(payloads)) {
            requestBuilder.setWithPayload(include(payloads));
        } else {
            requestBuilder.setWithPayload(enable(true));
        }
        if (Objects.nonNull(filter)) {
            requestBuilder.setFilter(filter);
        }

        if (Objects.nonNull(scoreThreshold)) {

View on GitHub (pinned to 2417e0b8b6)