t8y2/dbx · error · java.lang.IllegalArgumentException
Unsupported update option: <key>
Error message
Unsupported update option: <key>
What it means
The update-options parser only permits the 'arrayFilters' option. Any other key in the options_json document triggers this error, failing fast so callers know the option was silently ignored (the underlying API surface intentionally whitelists options).
Source
Thrown at agents/drivers/mongodb/src/main/java/com/dbx/agent/mongodb/MongoAgent.java:1613
requireBulkUpdateOperatorDocument(update);
return many ? col.updateMany(filter, update, options) : col.updateOne(filter, update, options);
}
private static UpdateResult updateDocumentsWithPipeline(
MongoCollection<Document> col, Document filter, List<Document> pipeline,
UpdateOptions options, boolean many) {
return many ? col.updateMany(filter, pipeline, options) : col.updateOne(filter, pipeline, options);
}
static UpdateOptions updateOptionsForWrite(String optionsJson) {
UpdateOptions result = new UpdateOptions();
if (optionsJson == null || optionsJson.trim().isEmpty()) {
return result;
}
Document options = Document.parse(optionsJson);
for (String key : options.keySet()) {
if (!"arrayFilters".equals(key)) {
throw new IllegalArgumentException("Unsupported update option: " + key);
}
}
Object rawFilters = options.get("arrayFilters");
if (rawFilters == null) {
return result;
}
if (!(rawFilters instanceof List<?>)) {
throw new IllegalArgumentException("arrayFilters must be an array");
}
List<Document> filters = new ArrayList<>();
for (Object filter : (List<?>) rawFilters) {
if (!(filter instanceof Document)) {
throw new IllegalArgumentException("Each arrayFilters entry must be an object");
}
filters.add((Document) filter);
}
return result.arrayFilters(filters);
}View on GitHub (pinned to c0390bff16)
Solutions
- Remove unsupported keys; keep only {"arrayFilters": [...]} if array-filtered updates are needed
- Fix typos: the key must be exactly "arrayFilters"
- If you need upsert or other options, apply them via a supported API surface or feature request rather than options_json
Example fix
// before
optionsJson = "{\"upsert\": true, \"arrayFilters\": [{\"elem.age\": {\"$gte\": 21}}]}";
// after
optionsJson = "{\"arrayFilters\": [{\"elem.age\": {\"$gte\": 21}}]}"; Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = ['arrayFilters'];
const opts = optionsJson ? JSON.parse(optionsJson) : {};
const unsupported = Object.keys(opts).filter(k => !ALLOWED.includes(k));
if (unsupported.length) throw new Error(`Unsupported update options: ${unsupported.join(', ')}`); Type guard
const hasOnlySupportedOptions = (opts) => opts == null || Object.keys(opts).every(k => k === 'arrayFilters');
Try / catch
try {
agent.update(filter, updateJson, optionsJson);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unsupported update option:")) {
const badKey = e.getMessage().split(':')[1].trim();
const opts = JSON.parse(optionsJson); delete opts[badKey];
agent.update(filter, updateJson, JSON.stringify(opts)); // retry without bad option
} else throw e;
} Prevention
- Check the supported-options list before passing options_json
- Spell "arrayFilters" exactly (plural, camelCase)
- Do not forward generic MongoDB driver options like upsert through this surface
When it happens
Trigger: Passing options like {"upsert": true}, {"bypassDocumentValidation": true}, or a typo'd key such as {"arrayFilter": [...]} (missing 's') in the update operation's options_json. Any key other than exactly 'arrayFilters' throws.
Common situations: Copy-pasting MongoDB driver options (upsert, collation, hint) that this tool does not support; misspelling arrayFilters; building options dynamically from user input containing unsupported flags; version drift where a previously tolerated option was removed from the whitelist.
Related errors
- Unsupported MongoDB aggregate cursor option: ${key}
- Unsupported MongoDB Legacy aggregate option: ${key}
- dropIndex only accepts a string index name or JSON document;
- dropIndexes only accepts arrays of string index names
- dropIndexes only accepts non-empty string arrays
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/33148dd172125ace.
Report an issue: GitHub.