t8y2/dbx · error · IllegalArgumentException
MongoDB aggregate pipeline is required
Error message
MongoDB aggregate pipeline is required
What it means
Thrown by MongoAgent.aggregatePipeline when the 'pipeline' parameter of an aggregate operation is missing, null, or blank. The aggregation command cannot run without a pipeline definition, so the request is rejected before parsing.
Source
Thrown at agents/drivers/mongodb/src/main/java/com/dbx/agent/mongodb/MongoAgent.java:521
try (MongoCursor<Document> cursor = iterable.iterator()) {
while (documents.size() < fetchLimit && cursor.hasNext()) {
Document document = cursor.next();
documents.add(bsonToJson(document));
extendedDocuments.add(bsonToExtendedJson(document));
}
}
long total = documents.size();
if (documents.size() > maxRows) {
documents.subList(maxRows, documents.size()).clear();
extendedDocuments.subList(maxRows, extendedDocuments.size()).clear();
}
return documentQueryResultWithExtended(documents, extendedDocuments, total);
}
static List<Document> aggregatePipeline(JsonObject params) {
String source = stringOrNull(params, "pipeline");
if (source == null || source.isBlank()) {
throw new IllegalArgumentException("MongoDB aggregate pipeline is required");
}
JsonElement parsed = JsonParser.parseString(source);
if (!parsed.isJsonArray()) {
throw new IllegalArgumentException("MongoDB aggregate pipeline must be a JSON array");
}
List<Document> pipeline = new ArrayList<>();
for (JsonElement stage : parsed.getAsJsonArray()) {
if (!stage.isJsonObject()) {
throw new IllegalArgumentException("Each MongoDB aggregate pipeline stage must be an object");
}
pipeline.add(Document.parse(stage.toString()));
}
return pipeline;
}
static Document aggregateOptions(JsonObject params) {
Document options = documentOrNull(params, "options");
return options == null ? new Document() : options;View on GitHub (pinned to c0390bff16)
Solutions
- Pass pipeline as a JSON array string, e.g. "[{\$match: {status: \"active\"}}]"
- Even for a no-filter aggregation supply at least an empty stage array or a trivial stage like [{"$limit": 10}]
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at agents/drivers/mongodb/src/main/java/com/dbx/agent/mongodb/MongoAgent.java:521 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/154511f580883be1.
Report an issue: GitHub.