louislam/uptime-kuma · warning · Error
Error evaluating JSON query: ${err.message}. Response from s
Error message
Error evaluating JSON query: ${err.message}. Response from server was: ${response} What it means
Outer catch-all in evaluateJsonQuery(): any error thrown inside the function's try block (the inner [254]-[258] guards, a JSONata syntax/compile error, a thrown type error, etc.) is re-thrown wrapped with the server response (stringified, truncated to 100 chars with an ellipsis when long). It is the message the monitor ultimately surfaces in bean.msg / the UI, so its suffix always echoes the response payload that caused the failure.
Source
Thrown at src/util.ts:773
const status = await expression.evaluate({
value: response.toString(),
expected: expectedValue.toString(),
});
if (status === undefined) {
throw new Error(
"Query evaluation returned undefined. Check query syntax and the structure of the response data"
);
}
return {
status, // The evaluation of the json query
response, // The response from the server or result from initial json-query evaluation
};
} catch (err: any) {
response = JSON.stringify(response); // Ensure the response is treated as a string for the console
response = response && response.length > 50 ? `${response.substring(0, 100)}… (truncated)` : response; // Truncate long responses to the console
throw new Error(`Error evaluating JSON query: ${err.message}. Response from server was: ${response}`);
}
}
// these types will have domain expiry support via the specified field
export const TYPES_WITH_DOMAIN_EXPIRY_SUPPORT_VIA_FIELD = {
http: "url",
keyword: "url",
"json-query": "url",
"real-browser": "url",
"websocket-upgrade": "url",
port: "hostname",
ping: "hostname",
"grpc-keyword": "grpcUrl",
dns: "hostname",
smtp: "hostname",
snmp: "hostname",
gamedig: "hostname",
steam: "hostname",View on GitHub (pinned to 6b5ea01557)
Solutions
- Read the inner message before 'Response from server was': it names the root cause (e.g. 'JSON query returned the array ...', 'Empty or undefined response...', 'Invalid condition ...').
Example fix
// before: monitor.jsonPath = "$.items[" (syntax error) -> wrapped -> "Error evaluating JSON query: ..."
// after: validate the path in isolation before saving the monitor
const jsonata = require("jsonata");
try {
await jsonata(monitor.jsonPath).evaluate(sampleResponseBody);
} catch (e) {
alert("JSONata error: " + e.message);
return;
} Defensive patterns
Strategy: try-catch
Validate before calling
try { await jsonata(jsonPath).evaluate(sample); } catch (e) { throw new Error("JSONata parse/eval failed: " + e.message); } Type guard
const isCompilableJsonata = (p) => { try { jsonata(p); return true; } catch { return false; } }; Try / catch
try { await evaluateJsonQuery(data, path, op, expected); } catch (e) { const inner = e.message.split(". Response from server")[0]; setMonitorDown(inner); } Prevention
- Validate the JSONata path against a sample body before saving the monitor.
- Read the inner message to find the root cause.
- Map json-query errors to a DOWN status rather than surfacing the raw exception.
When it happens
Trigger: Any json-query monitor failure: malformed JSONata syntax in monitor.jsonPath (unbalanced brackets, unknown function), the inner [254] undefined/null, [255] array, [256] object, [257] bad operator, [258] undefined evaluation, or an unexpected exception from the jsonata engine. Essentially the unified error shape for the whole evaluation pipeline.
Common situations: First symptom a user sees for any broken json-query monitor; appears in the monitor's last-failure message and incident text; frequently confused with a network error because it includes the raw response — but it actually indicates query-time failure on a successful HTTP fetch.
Related errors
- Empty or undefined response. Check query syntax and response
- JSON query returned the array ${truncatedResponse}, but a pr
- The post-JSON query evaluated response from the server is of
- Query evaluation returned undefined. Check query syntax and
- Message received but value is not equal to expected value, v
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/d3faac3064ac44d0.
Report an issue: GitHub.