louislam/uptime-kuma · warning · Error
Invalid condition ${jsonPathOperator}
Error message
Invalid condition ${jsonPathOperator} What it means
Thrown by evaluateJsonQuery()'s switch on jsonPathOperator when the value is not one of `>`, `>=`, `<`, `<=`, `!=`, `==`, `contains`. The operator selects the JSONata comparison expression, so an unrecognized operator cannot be compiled. The frontend default is "==" (EditMonitor.vue:3832), and the UI restricts the dropdown, but the server still guards against malformed DB values.
Source
Thrown at src/util.ts:750
let jsonQueryExpression;
switch (jsonPathOperator) {
case ">":
case ">=":
case "<":
case "<=":
jsonQueryExpression = `$number($.value) ${jsonPathOperator} $number($.expected)`;
break;
case "!=":
jsonQueryExpression = "$.value != $.expected";
break;
case "==":
jsonQueryExpression = "$.value = $.expected";
break;
case "contains":
jsonQueryExpression = "$contains($.value, $.expected)";
break;
default:
throw new Error(`Invalid condition ${jsonPathOperator}`);
}
// Evaluate the JSON Query Expression
const expression = jsonata(jsonQueryExpression);
const status = await expression.evaluate({
value: response.toString(),
expected: expectedValue.toString(),
});
if (status === undefined) {
throw new Error(
"Query evaluation returned undefined. Check query syntax and the structure of the response data"
);
}
return {
status, // The evaluation of the json query
response, // The response from the server or result from initial json-query evaluationView on GitHub (pinned to 6b5ea01557)
Solutions
- Reset the operator to a supported value via the UI or DB: one of >, >=, <, <=, !=, ==, contains.
- Audit existing monitors: `SELECT id, jsonPathOperator FROM monitor WHERE jsonPathOperator NOT IN ('>','>=','<','<=','!=','==','contains')`.
- If building a programmatic client, restrict the operator input to the documented enum.
- Normalize case and trim whitespace before storing the operator.
Example fix
// before: monitor.jsonPathOperator = "=" -> falls through -> throws // after const allowed = [">", ">=", "<", "<=", "!=", "==", "contains"]; monitor.jsonPathOperator = allowed.includes(op) ? op : "==";
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = [">", ">=", "<", "<=", "!=", "==", "contains"]; if (!ALLOWED.includes(operator)) operator = "==";
Type guard
const isAllowedOperator = (v) => typeof v === "string" && [">", ">=", "<", "<=", "!=", "==", "contains"].includes(v);
Try / catch
try { await evaluateJsonQuery(data, path, op, expected); } catch (e) { if (/Invalid condition/.test(e.message)) { op = "=="; /* retry */ } else throw e; } Prevention
- Restrict the operator input to the documented enum.
- Audit the DB for stray operator values.
- Trim and normalize case before storing.
When it happens
Trigger: A monitor row whose jsonPathOperator column contains an unsupported value: "=", "eq", "<>", "===" (three equals), "contains " (trailing space), or empty string. This can happen via direct DB edits, a buggy migration, or a programmatic API client that sets the operator outside the allowed set.
Common situations: Database edited by hand; data imported from another tool with different operator vocabulary; older record with a value no longer accepted; whitespace/case typo ("Contains", "CONTAINS"); a frontend bug writing the wrong enum.
Related errors
- Empty or undefined response. Check query syntax and response
- JSON query returned the array ${truncatedResponse}, but a pr
- The post-JSON query evaluated response from the server is of
- Query evaluation returned undefined. Check query syntax and
- Message received but value is not equal to expected value, v
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/0d0b8884d8649c07.
Report an issue: GitHub.