metricsign
Start free
Medium severitytimeout

Power BI Refresh Error:
-2

What does this error mean?

The client-side query timeout elapsed before SQL Server returned a result — the connection was terminated by the client.

Common causes

  • 1A long-running query exceeds the 30-second default Command Timeout in ADO.NET or ODBC
  • 2A blocking chain causes the query to wait for a lock longer than the timeout allows
  • 3Power BI or ADF uses the default timeout which is too short for a complex transformation query

How to fix it

  1. 1Step 1: Identify whether the query itself is slow or blocked: check sys.dm_exec_requests for the session — if wait_type is LCK_*, it is blocked; if CPU or IO, the query itself is slow.
  2. 2Step 2: For ADF, increase the query timeout in the dataset or activity settings — set Command Timeout to 0 (no timeout) for long-running ETL queries.
  3. 3Step 3: Optimize the slow query: run it in SSMS with Actual Execution Plan, add missing indexes, or reduce the dataset being processed.

Frequently asked questions

What is the default command timeout for ADF SQL Server activities?

ADF uses a 120-second default command timeout for most SQL activities. You can override it in the dataset connection properties or the activity's additional columns settings.

How do I set command timeout to unlimited in ADF?

In the ADF SQL dataset or linked service advanced settings, set queryTimeout to 0 or a large value like 7200 (2 hours). Note: a 0 value means no timeout.

Can Power BI gateway timeout cause error -2?

Yes — the Power BI gateway has its own query timeout (default 10 minutes for Import, varies for DirectQuery). If the SQL query takes longer, the gateway terminates it and Power BI reports a data source error.

Official documentation: https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors

Other timeout errors