diff --git a/cli/api/commands/run.ts b/cli/api/commands/run.ts index 3af5ec339..426a816e1 100644 --- a/cli/api/commands/run.ts +++ b/cli/api/commands/run.ts @@ -424,7 +424,7 @@ export class Runner { if (task.type === "assertion") { // We expect that an assertion query returns 1 row, with 1 field that is the row count. // We don't really care what that field/column is called. - const rowCount = rows[0][Object.keys(rows[0])[0]]; + const rowCount = rows[0]?.[Object.keys(rows[0])[0]]; if (rowCount > 0) { throw new Error(`Assertion failed: query returned ${rowCount} row(s).`); }