louislam/uptime-kuma · warning · Error

Queried value not found.

Error message

Queried value not found.

What it means

Thrown by the MongoDB monitor when monitor.jsonPath is set and the JSONata expression evaluates to a falsy value (null, undefined, empty). This means the path pointed at something that does not exist (or is empty) in the command result, so the query 'did not find' the value.

Source

Thrown at server/monitor-types/mongodb.js:32

        if (monitor.databaseQuery) {
            command = JSON.parse(monitor.databaseQuery);
        }

        let result = await this.runMongodbCommand(monitor.databaseConnectionString, command);

        if (result["ok"] !== 1) {
            throw new Error("MongoDB command failed");
        } else {
            heartbeat.msg = "Command executed successfully";
        }

        if (monitor.jsonPath) {
            let expression = jsonata(monitor.jsonPath);
            result = await expression.evaluate(result);
            if (result) {
                heartbeat.msg = "Command executed successfully and the jsonata expression produces a result.";
            } else {
                throw new Error("Queried value not found.");
            }
        }

        if (monitor.expectedValue) {
            if (result.toString() === monitor.expectedValue) {
                heartbeat.msg = "Command executed successfully and expected value was found";
            } else {
                throw new Error(
                    "Query executed, but value is not equal to expected value, value was: [" +
                        JSON.stringify(result) +
                        "]"
                );
            }
        }

        heartbeat.status = UP;
    }

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Run the same command and inspect the full result object to find the correct path
  2. Test the JSONata expression against a sample result in the JSONata playground
  3. Confirm the field is populated at check time (not transiently empty)
  4. If you only need a value comparison, ensure jsonPath resolves to a non-empty value

Example fix

// before: path does not exist on result
monitor.jsonPath = "$.opcounters.query"; // field absent
// after: correct field from the command result
monitor.jsonPath = "$.opcounters.query"; // after confirming via db.command() output
Defensive patterns

Strategy: validation

Validate before calling

// Validate JSONata expression syntax before running
if (monitor.jsonPath) {
    try { jsonata(monitor.jsonPath); } catch {
        throw new Error("Invalid JSONata jsonPath: " + monitor.jsonPath);
    }
}

Try / catch

if (monitor.jsonPath) {
    const expression = jsonata(monitor.jsonPath);
    result = await expression.evaluate(result);
    if (!result) throw new Error("Queried value not found.");
}

Prevention

When it happens

Trigger: monitor.jsonPath is truthy, expression.evaluate(result) returns a falsy value (null/undefined/''). E.g. jsonPath '$.connections.current' on a result that has no 'connections' field.

Common situations: jsonPath does not match the actual shape of the command's result object, the field is genuinely null/empty at this moment, or the jsonPath syntax is wrong for JSONata.

Related errors


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