MetricSign
Start free
Medium severityconnectionSnowflake

Snowflake Error:
SQL execution canceled

What does this error mean?

A Snowflake JDBC driver statement was cancelled, either by the client application, by a Snowflake administrator, or automatically due to a STATEMENT_TIMEOUT_IN_SECONDS or STATEMENT_QUEUED_TIMEOUT_IN_SECONDS limit being reached.

Common causes

  • 1The JDBC connection pool reclaimed the connection while a long query was executing, cancelling the statement
  • 2A Snowflake administrator used ALTER SESSION ABORT QUERY to cancel the query
  • 3STATEMENT_QUEUED_TIMEOUT_IN_SECONDS was reached while the query waited in the warehouse queue
  • 4The BI tool or ETL framework has a built-in query timeout that sent a cancel signal before Snowflake finished
  • 5A transient network interruption broke the JDBC connection, causing Snowflake to cancel the query

How to fix it

  1. 1Check QUERY_HISTORY with the error_code column to determine whether the cancel was client-initiated or Snowflake-initiated.
  2. 2For queue timeout, increase the warehouse size or switch to a multi-cluster warehouse to reduce queuing.
  3. 3For JDBC pool reclaim, increase the connection keep-alive or idle timeout in the JDBC pool configuration.
  4. 4For BI tool timeouts, increase the query timeout in the tool's data source settings.
  5. 5Inspect for network issues: Snowflake's query history will show if the cancellation correlates with connectivity interruptions.

Frequently asked questions

How do I tell the difference between a timeout cancel and an admin cancel in QUERY_HISTORY?

Filter QUERY_HISTORY WHERE error_code IS NOT NULL. An admin cancel shows error_code 000604 (query aborted by admin). A timeout cancel shows 000630. A queue timeout shows 000631.

Can JDBC auto-retry cancelled statements?

JDBC drivers do not auto-retry cancelled statements by default. Implement retry logic in the application layer with exponential backoff, and only retry on cancellation codes that indicate transient conditions (e.g. queue timeout).

Source · docs.snowflake.com/en/sql-reference/errors

Other connection errors