Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#7153·growthbook

[Bug] Trino/Presto query errors render as "[object Object]" (regression from 4.3 to 5.0.1)

Author: larissaminariniCreated Sep 25, 2026Updated Sep 26, 2026

Bug description

After upgrading GrowthBook from 4.3 to 5.0.1, query errors from a Trino datasource are no longer shown as readable messages in the UI/API — they render as the literal string "[object Object]".

Reproduction

Datasource type: Trino Endpoint: POST /query/test

Response body when the SQL has a syntax error:

json
{
  "status": 200,
  "sql": "WITH\n  __table as (\n    SELECT\n      user_id,\n      eligibility_id,\n      ...\n    FROM\n      hive.experimentation.events\n  )\nSELECT\n  *\nFROM\n  __table\nWHERE\n  timestamp >= from_iso8601_timestamp('2026-09-18T20:23:40.911Z')\nLIMIT\n  5",
  "error": "[object Object]"
}

The error field itself contains the literal string "[object Object]" — this is happening server-side, not a front-end rendering issue.

Root cause

In v4.3.0, testQuery() in packages/back-end/src/services/datasource.ts caught query errors like this:

javascript
catch (e) {
  return {
    error: e.message,
    sql,
  };
}

In the current codebase, this was refactored into formatQueryExecutionErrorForApi() in packages/shared/src/util/managedWarehouse.ts:

javascript
export function formatQueryExecutionErrorForApi(e: unknown): string {
  if (e instanceof ManagedWarehousePendingError) {
    return MANAGED_WAREHOUSE_PENDING_ERROR_CODE;
  }
  if (e instanceof Error && e.message === MANAGED_WAREHOUSE_PENDING_ERROR_CODE) {
    return MANAGED_WAREHOUSE_PENDING_ERROR_CODE;
  }
  if (e instanceof ManagedWarehouseOutOfMemoryError) {
    return MANAGED_WAREHOUSE_OUT_OF_MEMORY_ERROR_CODE;
  }
  return e instanceof Error ? e.message : String(e);
}

The Trino/Presto integration (packages/back-end/src/integrations/Presto.ts) rejects its query promise with the raw error object from the presto-client driver, e.g.:

javascript
error: (error) => {
  reject(error);
},

That rejected value is a plain object (it has a .message property, which is why the old e.message access in 4.3 worked), but it is not an instanceof Error. So in the new formatQueryExecutionErrorForApi, the instanceof Error check fails, the .message is discarded, and it falls through to String(e) — which for a plain object resolves to Object.prototype.toString(), i.e. the literal string "[object Object]".

Suggested fix

Fall back to reading .message off non-Error objects before stringifying, e.g.:

javascript
return e instanceof Error
  ? e.message
  : (typeof e === "object" && e !== null && "message" in e
      ? String((e as { message: unknown }).message)
      : String(e));

Or, more robustly, normalize the error at the source in Presto.ts so runQuery/runTestQuery always rejects with an actual Error instance instead of the raw driver error object.

Environment

  • GrowthBook version: 5.0.1 (regression not present in 4.3)
  • Datasource: Trino

Source: growthbook/growthbook

View original on GitHubView discussion on GitHub