---
title: Common Error Patterns
meta:
    description: Learn about common error patterns in Tinybird and how to resolve them.
---

# Common Error Patterns

This guide explains common error patterns you might encounter when working with Tinybird and provides solutions to resolve them. Check here for the [full list of errors](./list-of-errors).

### MEMORY_LIMIT_EXCEEDED (241)

This error occurs when a query requires more memory than the available limit.

**Common causes:**
- Large result sets
- Complex joins or query time computations
- Insufficient sorting key optimization

**Solutions:**
- Optimize your sorting key to better match query patterns
- Add appropriate indexes
- Break down complex queries into smaller parts
- Precompute functions (E.g. [JSONExtract()](/sql-reference/functions/json-functions#jsonextract-functions)) and materialize in an intermediate data source.
- Use `LIMIT` clauses when appropriate

### TIMEOUT_EXCEEDED (159)

This error indicates that a query took longer than the default limit of 10 seconds to execute. 

**Common causes:**
- Complex queries without proper optimization
- Large data scans
- Inefficient sorting keys

**Solutions:**
- Review and optimize your sorting key (do they align with the query filters?)
- Add appropriate indexes
- Consider materializing frequently used queries
- Break down complex queries

### TOO_MANY_PARTS (252)

This error occurs when you have too many data parts in a partition.

**Common causes:**
- Writing to more than 30 partitions in a single ingest.
- Partition Key is too granular for regular ingests (e.g., a unique ID or a full-precision timestamp)
- Partition Key is too granular for large historic backfills (e.g., month)

**Solutions:**
- Break your inserts into smaller chunks
- Reduce partition granularity
