{"record":{"id":"46afe16544a5eb27","repo":"louislam/uptime-kuma","slug":"query-result-did-not-meet-the-specified-conditions-46afe1","errorCode":null,"errorMessage":"Query result did not meet the specified conditions (${result})","messagePattern":"Query result did not meet the specified conditions \\((.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/monitor-types/oracledb.js","lineNumber":42,"sourceCode":"\n        const conditions = monitor.conditions ? ConditionExpressionGroup.fromMonitor(monitor) : null;\n        const hasConditions = conditions && conditions.children && conditions.children.length > 0;\n\n        const startTime = dayjs().valueOf();\n        try {\n            if (hasConditions) {\n                const result = await this.oracledbQuerySingleValue(\n                    monitor.databaseConnectionString,\n                    query,\n                    monitor.basic_auth_user,\n                    monitor.basic_auth_pass\n                );\n                heartbeat.ping = dayjs().valueOf() - startTime;\n\n                const conditionsResult = evaluateExpressionGroup(conditions, { result: String(result) });\n\n                if (!conditionsResult) {\n                    throw new Error(`Query result did not meet the specified conditions (${result})`);\n                }\n\n                heartbeat.status = UP;\n                heartbeat.msg = \"Query did meet specified conditions\";\n            } else {\n                const result = await this.oracledbQuery(\n                    monitor.databaseConnectionString,\n                    query,\n                    monitor.basic_auth_user,\n                    monitor.basic_auth_pass\n                );\n                heartbeat.ping = dayjs().valueOf() - startTime;\n                heartbeat.status = UP;\n                heartbeat.msg = result;\n            }\n        } catch (error) {\n            heartbeat.ping = dayjs().valueOf() - startTime;\n            if (error.message.includes(\"did not meet the specified conditions\")) {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/oracledb.js#L24-L60","documentation":"Thrown by OracledbMonitorType.check when conditions are configured and the single-value result does not satisfy evaluateExpressionGroup({result: String(result)}). Same semantics as the MSSQL/MySQL variants: the only exposed variable is 'result', stringified before the condition evaluates.","triggerScenarios":"monitor.conditions has children, oracledbQuerySingleValue returns a scalar, and evaluateExpressionGroup over {result: String(result)} is false. Oracle-specific gotchas: NUMBER stringification, NLS date/decimal formatting, CLOB returned as a stream object, and case-sensitive column naming.","commonSituations":"NUMBER column returning '12,34' under a European NLS; DATE formatted by NLS_DATE_FORMAT; CLOB not converted to string; condition references the wrong variable; condition literal doesn't match Oracle's coercion.","solutions":["Run the query in SQL Developer/SQLcl with the same user and NLS, and inspect the value's string form.","Cast explicitly: TO_CHAR(col), CAST(col AS NUMBER), or ROUND(col,n) so the output is deterministic and NLS-independent.","Use TO_CHAR(datecol,'YYYY-MM-DD HH24:MI:SS') for dates instead of relying on NLS_DATE_FORMAT.","Reference only the 'result' variable; prefer numeric range operators over '==' for numbers."],"exampleFix":"-- before: SELECT last_sync FROM config;            (NLS-formatted DATE)\n-- after:  SELECT TO_CHAR(last_sync,'YYYY-MM-DD HH24:MI:SS') FROM config;","handlingStrategy":"try-catch","validationCode":"const scalar = await oracleMonitor.oracledbQuerySingleValue(connStr, query, user, pass);\nconst ok = evaluateExpressionGroup(group, { result: String(scalar) });","typeGuard":"function conditionUsesResultVar(group) { return group.children.every(c => c.variable === 'result'); }","tryCatchPattern":"try { await oracleMonitor.check(monitor, heartbeat, server); }\ncatch (e) { if (/did not meet the specified conditions/.test(e.message)) { heartbeat.status = DOWN; heartbeat.msg = e.message; } else throw e; }","preventionTips":["Cast/TO_CHAR in SQL so the value is NLS-independent (TO_CHAR(date,'YYYY-MM-DD HH24:MI:SS'), ROUND).","Reference only 'result'; use numeric range operators for NUMBER columns.","Beware NLS decimal/date formatting and CLOB streaming in single-value mode."],"tags":["oracle","oracledb","conditions","database","uptime-kuma"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}