Azure Data Factory · Timeouts

“Execution Timeout Expired” in an Azure Data Factory Copy activity

A SQL statement issued by the Copy activity ran longer than its timeout, so the client stopped waiting and the statement was cancelled. Find out whether the read or the write was slow, make that statement faster, and raise the matching timeout only when the work really needs the time.

The error
ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed. Please search error to get more details.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Data.SqlClient.SqlException,Message=Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.,Source=.Net SqlClient Data Provider,SqlErrorNumber=-2,Class=11,ErrorCode=-2146232060,State=0,Errors=[{Class=11,Number=-2,State=0,Message=Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.,},{Class=0,Number=3621,State=0,Message=The statement has been terminated.,},],''Type=System.ComponentModel.Win32Exception,Message=The wait operation timed out,Source=,'

What this error means

Error -2 does not come from the database engine. The SQL client inside the integration runtime raises it when a statement is still running at the end of its timeout. Microsoft’s troubleshooting guide calls it a query time-out and points at two settings: Query timeout on the source and Write batch timeout on the sink.

The timeout is a symptom. The statement slowed down because there was more data, a different query plan, blocking by another session, or a database with too little capacity for the load.

Why it happens

  • The source query became slower. The table grew, statistics went stale, or an incremental filter stopped using an index, so the query now reads far more rows.
  • A write batch took too long. Upserts are the usual case: every batch has to be matched against the sink table on its key columns, and without an index on those columns each match scans the table.
  • The database is short of capacity. A small service tier, or other heavy work at the same time, slows every statement until one passes its limit.
  • Another session holds a lock. A long transaction on the same table blocks the read or the write until the timeout passes.

How to fix it

  1. Find the slow side

    In Monitor, open the details of the copy activity run. The duration breakdown shows how long the run spent reading from the source and writing to the sink.

  2. For the source, run the query yourself

    Copy the query from the activity run’s input and run it against the database. If it is slow there as well, tune it: filter on an indexed column, update statistics, or read the table in partitions.

  3. For the sink, help each batch finish

    Add an index on the upsert key columns, lower the write batch size so that each batch is smaller, and check that the database is not at the limit of its tier during the load.

  4. Raise the timeout that was reached

    On the source, increase Query timeout. On the sink, increase Write batch timeout, writeBatchTimeout in the pipeline JSON, which is 30 minutes when it is not set. Do this once the statement is as fast as it can be, not instead.

    Sink: smaller batches and a longer batch timeout
    01 "sink": {02   "type": "AzureSqlSink",03-  "writeBatchSize": 10000004+  "writeBatchSize": 10000,05+  "writeBatchTimeout": "01:00:00"06 }
  5. Rerun and compare

    Rerun the pipeline from the failed activity and compare the read and write durations with a run from before the failure.

How to stop it coming back

  • Load incrementally with a watermark, so each run reads only the rows that are new.
  • Keep an index on the columns used for upserts and for incremental filters.
  • Watch the read and write durations from run to run. A steady rise is the warning that comes before the timeout.

With PipelineMender AI

The next failed run explains itself.

PipelineMender reads the failed Copy activity’s error, its input and output, and the pipeline definition with the Reader role on the factory. For this failure the report states where the run stopped, quotes the batch and timeout settings it found in the pipeline, and proposes a specific change for you to review.

Is the error in front of you now? Start a trial, choose Report an incident and paste it in. No connection is needed for that.

  • Read-only access
  • You review every change
  • No model training

Questions

Common questions about this error.

What is SQL error -2?

It is the timeout of the SQL client library, not an error of the database engine. The statement was still running when its timeout ended, so the client stopped waiting and the statement was cancelled.

Should I simply increase the timeout?

Only when the statement is already efficient and the work needs the time. If a run that took minutes now takes hours, a longer timeout hides the cause and the next run will be slower still.

Why does it time out only on some days?

Because the amount of data or the load on the database differs. A month-end volume, a backfill or another job running at the same time can push one statement past its limit.

Checked against: Troubleshoot the SQL connectors (Azure Data Factory) Copy data to and from Azure SQL Database Monitor copy activity Copy activity performance and scalability guide

Last reviewed 13 November 2026 against Microsoft’s documentation. PipelineMender AI is an independent product and is not affiliated with Microsoft or Databricks; product names are trademarks of their owners.