louislam/uptime-kuma · error · Error
JSON query does not pass (comparing ${response} ${monitor.js
Error message
JSON query does not pass (comparing ${response} ${monitor.jsonPathOperator} ${monitor.expectedValue}) What it means
Thrown by handleJSONQueryForHTTP when evaluateJsonQuery returns status === false. The message echoes the actual response value, the operator, and the expected value so you can see exactly which comparison failed. This runs only when monitor.expectedValue is set (and no keyword took precedence).
Source
Thrown at server/monitor-types/globalping.js:425
/**
* Handles JSON query for HTTP monitors.
* @param {Monitor} monitor - The monitor object.
* @param {Heartbeat} heartbeat - The heartbeat object.
* @param {Result} result - The result object.
* @param {Probe} probe - The probe object.
* @returns {Promise<void>} A promise that resolves when the JSON query is handled.
*/
async handleJSONQueryForHTTP(monitor, heartbeat, result, probe) {
const { status, response } = await evaluateJsonQuery(
result.rawOutput,
monitor.jsonPath,
monitor.jsonPathOperator,
monitor.expectedValue
);
if (!status) {
throw new Error(
this.formatResponse(
probe,
`JSON query does not pass (comparing ${response} ${monitor.jsonPathOperator} ${monitor.expectedValue})`
)
);
}
heartbeat.msg = this.formatResponse(
probe,
`JSON query passes (comparing ${response} ${monitor.jsonPathOperator} ${monitor.expectedValue})`
);
heartbeat.status = UP;
}
/**
* Updates the TLS information for a monitor.
* @param {object} monitor - The monitor object.
* @param {string} protocol - The protocol used for the monitor.View on GitHub (pinned to 6b5ea01557)
Solutions
- Compare the echoed 'response' value against expectedValue with the chosen operator
- Verify monitor.jsonPath still resolves against the current response shape (use a JSONPath tester)
- Ensure the operator is appropriate for the value's type
- Confirm expectedValue is the correct type/string the API returns
Example fix
// before: wrong type comparison monitor.jsonPath = "$.status"; monitor.jsonPathOperator = "=="; monitor.expectedValue = 200; // API returns "ok" // after monitor.expectedValue = "ok";
Defensive patterns
Strategy: validation
Validate before calling
// Validate JSONPath and operator before running
const validOps = ['==','!=','<','<=','>','>=','contains'];
if (!validOps.includes(monitor.jsonPathOperator)) {
throw new Error("Invalid jsonPathOperator: " + monitor.jsonPathOperator);
}
try { jsonata(monitor.jsonPath); } catch {
throw new Error("Invalid JSONPath expression: " + monitor.jsonPath);
} Try / catch
const { status, response } = await evaluateJsonQuery(result.rawOutput, monitor.jsonPath, monitor.jsonPathOperator, monitor.expectedValue);
if (!status) {
throw new Error(this.formatResponse(probe,
`JSON query does not pass (comparing ${response} ${monitor.jsonPathOperator} ${monitor.expectedValue})`));
} Prevention
- Test the JSONPath against a sample response before enabling the monitor
- Ensure the operator matches the value's data type
- Set expectedValue to the same type the API returns
When it happens
Trigger: evaluateJsonQuery(result.rawOutput, monitor.jsonPath, monitor.jsonPathOperator, monitor.expectedValue) resolves with status false. E.g. jsonPath points to a field whose value does not satisfy the operator against expectedValue.
Common situations: The API response shape changed so jsonPath no longer resolves, the operator is wrong (e.g. '<' on a string), expectedValue type mismatch (string vs number), or the JSON body is not valid JSON.
Related errors
- Status code ${result.statusCode} not accepted. Output: ${res
- ${heartbeat.msg}, but keyword is ${keywordFound ? "present"
- Headers must be valid JSON: ${e.message}
- Accepted status codes must be valid JSON: ${e.message}
- No record matched.
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/b60d0fcbbd09fabb.
Report an issue: GitHub.