louislam/uptime-kuma · error · Error

JSON query does not pass (comparing ${response} ${this.jsonP

Error message

JSON query does not pass (comparing ${response} ${this.jsonPathOperator} ${this.expectedValue})

What it means

Thrown by the json-query monitor when evaluateJsonQuery returns status=false. The message echoes the actual response value, the operator, and expectedValue so you can see exactly which comparison failed.

Source

Thrown at server/model/monitor.js:723

                                    data +
                                    "]"
                            );
                        }
                    } else if (this.type === "json-query") {
                        let data = res.data;

                        const { status, response } = await evaluateJsonQuery(
                            data,
                            this.jsonPath,
                            this.jsonPathOperator,
                            this.expectedValue
                        );

                        if (status) {
                            bean.status = UP;
                            bean.msg = `JSON query passes (comparing ${response} ${this.jsonPathOperator} ${this.expectedValue})`;
                        } else {
                            throw new Error(
                                `JSON query does not pass (comparing ${response} ${this.jsonPathOperator} ${this.expectedValue})`
                            );
                        }
                    }
                } else if (this.type === "ping") {
                    bean.ping = await ping(
                        this.hostname,
                        this.ping_count,
                        "",
                        this.ping_numeric,
                        this.packetSize,
                        this.timeout,
                        this.ping_per_request_timeout
                    );
                    bean.msg = "";
                    bean.status = UP;
                } else if (this.type === "push") {
                    // Type: Push

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Read the actual 'response' value printed in the message and compare it to expectedValue
  2. Verify the JSONPath resolves correctly (test at jsonpath.com or in a REPL)
  3. Match types: quote string expected values, leave numeric ones bare
  4. Confirm the operator meaning against the documented set before saving
Defensive patterns

Strategy: validation

Validate before calling

// Evaluate a sample API response with the same path/operator/expected before saving
function queryWillPass(sampleJson, jsonPath, operator, expected) {
  const { status } = evaluateJsonQuery(sampleJson, jsonPath, operator, expected);
  return status === true;
}

Prevention

When it happens

Trigger: API returns JSON whose JSONPath value fails the operator comparison against expectedValue (e.g. $.status != "ok", numeric out of range, type mismatch).

Common situations: API response shape changed; wrong JSONPath expression; string-vs-number type mismatch (expectedValue "200" vs number 200); operator confusion (contains vs ==).

Related errors


AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12). Data as JSON: /api/errors/2c000fe5fd89070e. Report an issue: GitHub.