Error 735: QUERY_WAS_CANCELLED_BY_CLIENT
This error occurs when your query was stopped because the client application that sent it cancelled the request. This is a client-side cancellation, not a ClickHouse server issue - it means your application, driver, or tool explicitly told ClickHouse to stop executing the query.
What this error means
When a client connects to ClickHouse and sends a query, it can later send a "Cancel" packet to stop that query mid-execution. ClickHouse receives this cancellation signal and immediately stops processing the query, throwing error 735. This is the expected behavior when:
- A user clicks "Stop" in a query tool
- An application has a timeout and cancels the query
- A connection is closed or lost
- A client explicitly calls a cancel/interrupt method
Potential causes
- Client timeouts - Your application or driver has a query timeout shorter than the query execution time
- User cancellation - A user manually stopped the query in a UI tool (SQL Console, DBeaver, etc.)
- Connection issues - Network problems causing the client to disconnect and cancel queries
- Application logic - Your code explicitly cancels queries based on business logic
- Load balancer/proxy timeouts - Intermediate infrastructure timing out before the query completes
- Resource exhaustion - Client running out of memory or resources while processing results
When you'll see it
Common scenarios from production
Real-world examples
Example 1: Grafana dashboard timeout
Example 2: Application driver timeout
Quick fixes
1. Increase client timeout settings
Go driver (clickhouse-go):
Python driver (clickhouse-driver):
JDBC driver:
2. Check for query timeout settings
3. Optimize slow queries
If queries are timing out because they're too slow:
4. Handle cancellations gracefully in your application
5. Check for infrastructure timeouts
- Load balancers: AWS ALB has 60s default timeout, increase to 300s+
- Proxies: Check HAProxy, Nginx timeouts
- Cloud providers: Check cloud-specific connection limits
Understanding the root cause
This error is informational from ClickHouse's perspective—it's telling you that it successfully cancelled the query as requested by the client. The actual problem is:
- Why did the client cancel? (timeout, user action, connection loss)
- Is the query too slow? (needs optimization)
- Are timeout settings too aggressive? (need tuning)
Related errors
- Error 159:
TIMEOUT_EXCEEDED- Server-side timeout (set bymax_execution_time) - Error 210:
NETWORK_ERROR- Network connection problems - Error 394:
QUERY_WAS_CANCELLED- Server-side cancellation (vs client-side 735)
Troubleshooting steps
-
Check query logs to see how long queries ran before cancellation:
-
Monitor client connection metrics:
-
Check for patterns: Are cancellations happening at a specific time threshold? This indicates a timeout setting somewhere in your stack.