{"record":{"id":"2c000fe5fd89070e","repo":"louislam/uptime-kuma","slug":"json-query-does-not-pass-comparing-response","errorCode":null,"errorMessage":"JSON query does not pass (comparing ${response} ${this.jsonPathOperator} ${this.expectedValue})","messagePattern":"JSON query does not pass \\(comparing (.+?) (.+?) (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/model/monitor.js","lineNumber":723,"sourceCode":"                                    data +\n                                    \"]\"\n                            );\n                        }\n                    } else if (this.type === \"json-query\") {\n                        let data = res.data;\n\n                        const { status, response } = await evaluateJsonQuery(\n                            data,\n                            this.jsonPath,\n                            this.jsonPathOperator,\n                            this.expectedValue\n                        );\n\n                        if (status) {\n                            bean.status = UP;\n                            bean.msg = `JSON query passes (comparing ${response} ${this.jsonPathOperator} ${this.expectedValue})`;\n                        } else {\n                            throw new Error(\n                                `JSON query does not pass (comparing ${response} ${this.jsonPathOperator} ${this.expectedValue})`\n                            );\n                        }\n                    }\n                } else if (this.type === \"ping\") {\n                    bean.ping = await ping(\n                        this.hostname,\n                        this.ping_count,\n                        \"\",\n                        this.ping_numeric,\n                        this.packetSize,\n                        this.timeout,\n                        this.ping_per_request_timeout\n                    );\n                    bean.msg = \"\";\n                    bean.status = UP;\n                } else if (this.type === \"push\") {\n                    // Type: Push","sourceCodeStart":705,"sourceCodeEnd":741,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/model/monitor.js#L705-L741","documentation":"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.","triggerScenarios":"API returns JSON whose JSONPath value fails the operator comparison against expectedValue (e.g. $.status != \"ok\", numeric out of range, type mismatch).","commonSituations":"API response shape changed; wrong JSONPath expression; string-vs-number type mismatch (expectedValue \"200\" vs number 200); operator confusion (contains vs ==).","solutions":["Read the actual 'response' value printed in the message and compare it to expectedValue","Verify the JSONPath resolves correctly (test at jsonpath.com or in a REPL)","Match types: quote string expected values, leave numeric ones bare","Confirm the operator meaning against the documented set before saving"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Evaluate a sample API response with the same path/operator/expected before saving\nfunction queryWillPass(sampleJson, jsonPath, operator, expected) {\n  const { status } = evaluateJsonQuery(sampleJson, jsonPath, operator, expected);\n  return status === true;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test the JSONPath against a real response sample before enabling the monitor","Match expectedValue types to the resolved value (string vs number)"],"tags":["json","jsonpath","query","monitoring"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}