louislam/uptime-kuma · error · Error
Multiple values were found, expected only one value
Error message
Multiple values were found, expected only one value
What it means
Thrown by oracledbQuerySingleValue when the query returns more than one row. With conditions enabled the monitor needs exactly one scalar; multiple rows are ambiguous and rejected before column-count validation.
Source
Thrown at server/monitor-types/oracledb.js:131
*/
async oracledbQuerySingleValue(connectionString, query, username, password) {
let connection;
try {
connection = await oracledb.getConnection({
connectString: connectionString,
user: username,
password: password,
});
const result = await connection.execute(query, [], {
outFormat: oracledb.OUT_FORMAT_OBJECT,
});
if (!result.rows || result.rows.length === 0) {
throw new Error("Query returned no results");
}
if (result.rows.length > 1) {
throw new Error("Multiple values were found, expected only one value");
}
const firstRow = result.rows[0];
const columnNames = Object.keys(firstRow);
if (columnNames.length > 1) {
throw new Error("Multiple columns were found, expected only one value");
}
return firstRow[columnNames[0]];
} catch (error) {
log.debug(this.name, "Error caught in the query execution.", error.message);
throw error;
} finally {
if (connection) {
await connection.close();
}
}View on GitHub (pinned to 6b5ea01557)
Solutions
- Limit to one row: ... FETCH FIRST 1 ROWS ONLY (12c+) or wrap with ROWNUM <= 1 plus ORDER BY.
- Tighten the WHERE clause so at most one row matches.
- Collapse to an aggregate (MAX/MIN/SUM) returning one scalar.
- Disable conditions if you only need connection/row-count semantics.
Example fix
-- before: SELECT cpu_pct FROM metrics ORDER BY ts DESC; (many rows) -- after: SELECT cpu_pct FROM metrics ORDER BY ts DESC FETCH FIRST 1 ROWS ONLY;
Defensive patterns
Strategy: validation
Validate before calling
async function oracleRowCount(connStr, query, user, pass) {
const c = await oracledb.getConnection({ connectString: connStr, user, password: pass });
try { return (await c.execute(query)).rows?.length ?? 0; } finally { await c.close(); }
} Type guard
function isSingleRow(r) { return r?.rows?.length === 1; } Prevention
- Add FETCH FIRST 1 ROWS ONLY (12c+) or ROWNUM <= 1 with a deterministic ORDER BY.
- Collapse to an aggregate when you only need a scalar.
- Tighten WHERE so at most one row matches; run the query in SQL Developer first.
When it happens
Trigger: monitor.conditions non-empty and result.rows.length > 1. Common with SELECT col FROM table without ROWNUM/ROW_LIMIT or FETCH FIRST, missing WHERE, or a join that fans out.
Common situations: No WHERE / no row-limit on a multi-row table; conditions enabled on a query written for the row-count path; cartesian join.
Related errors
- Query returned no results
- Multiple values were found, expected only one value
- Query result did not meet the specified conditions (${result
- Database connection/query failed: ${error.message}
- Query returned no results
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/1875ba4f59005f0a.
Report an issue: GitHub.