SQLITE_INTERRUPT: interrupted
This error occurs when a long-running query is cancelled, typically via sqlite3_interrupt() or a timeout. Learn how to handle query cancellation gracefully.
The interrupted error means a query was cancelled before completion.
Understanding the Error
SQLITE_INTERRUPT: interrupted
Something called sqlite3_interrupt() on the database connection, or a progress callback returned non-zero.
Common Causes
1. User Cancelled Operation
User clicked "Cancel" on a long-running query.
2. Timeout
Query exceeded a time limit:
JAVASCRIPT
3. Progress Callback
A progress handler decided to stop:
JAVASCRIPT
4. Signal Handler
Application received SIGINT or similar.
How to Fix It
Solution 1: Handle Gracefully
JAVASCRIPT
Solution 2: Implement Proper Cancellation
JAVASCRIPT
Solution 3: Use Timeout Wrapper
JAVASCRIPT
Solution 4: Batch Long Operations
JAVASCRIPT
Best Practices
- Handle SQLITE_INTERRUPT in error handling
- Show progress for long operations
- Allow cancellation for user-facing queries
- Set reasonable timeouts to prevent runaway queries
- Batch large operations for responsiveness