louislam/uptime-kuma · warning · 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 when evaluateJsonQuery() resolves with status === false. The SNMP value was retrieved successfully and parsed, but it did not satisfy the configured jsonPath/jsonPathOperator/expectedValue predicate. This is an expected DOWN heartbeat path, not a crash: the monitor ran correctly and reported that the comparison failed.

Source

Thrown at server/monitor-types/snmp.js:74

            if (varbinds[0].type === snmp.ObjectType.NoSuchInstance) {
                throw new Error(`The SNMP query returned that no instance exists for OID ${monitor.snmpOid}`);
            }

            // We restrict querying to one OID per monitor, therefore `varbinds[0]` will always contain the value we're interested in.
            const value = varbinds[0].value;

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

            if (status) {
                heartbeat.status = UP;
                heartbeat.msg = `JSON query passes (comparing ${response} ${monitor.jsonPathOperator} ${monitor.expectedValue})`;
            } else {
                throw new Error(
                    `JSON query does not pass (comparing ${response} ${monitor.jsonPathOperator} ${monitor.expectedValue})`
                );
            }
        } finally {
            if (session) {
                session.close();
            }
        }
    }
}

module.exports = {
    SNMPMonitorType,
};

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Inspect heartbeat.msg of the passing branch to see the actual response value and confirm it is the type/format you expect.
  2. Align jsonPathOperator and expectedValue to the real SNMP value type (use a numeric operator only when the value is numeric).
  3. Leave jsonPath empty for scalar SNMP values so evaluateJsonQuery compares the raw value directly.
  4. If the comparison legitimately fails, treat this as a correct DOWN signal and adjust the expectedValue threshold rather than the code.
Defensive patterns

Strategy: validation

Validate before calling

function coerceExpected(value, expected, operator) {
  if (["<", "<=", ">", ">="].includes(operator)) {
    return { value: Number(value), expected: Number(expected) };
  }
  return { value, expected };
}

Type guard

function isNumericOp(op) { return ["<", "<=", ">", ">="].includes(op); }

Try / catch

// This is an expected DOWN path — surface it, don't crash the runner.
if (!status) { heartbeat.status = DOWN; heartbeat.msg = `compare failed: ${response} ${op} ${expected}`; }

Prevention

When it happens

Trigger: Triggered whenever the operator predicate (==, <, >, contains, etc.) applied to the extracted response and expectedValue yields false. For example, CPU load returned 95 but expectedValue was 50 with operator '<', or a string OID value did not equal the expected literal.

Common situations: Operator/operand type mismatch (string vs number comparison), wrong jsonPath for the SNMP scalar (SNMP values are not JSON — jsonPath is often left empty and the operator compares the raw value), expectedValue entered with wrong units or formatting, or the monitored condition genuinely degraded (disk full, service down) and the monitor correctly flagged it.

Related errors


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