---
title: Function-specific issues
meta:
  description: Common issues and solutions when working with specific function types in ClickHouse and Tinybird.
---

# Function-specific issues

Common issues and solutions when working with specific function types in ClickHouse and Tinybird.

## Overview

This section covers troubleshooting for specific function categories that commonly cause issues in ClickHouse and Tinybird.

## Function categories

### Date and time functions

Common issues with date and time operations:

- **ILLEGAL_TYPE_OF_ARGUMENT** - Wrong data types passed to date functions
- **CANNOT_PARSE_DATETIME** - Invalid date formats
- **Timezone handling** - Unexpected timezone conversions
- **Date arithmetic** - Performance issues in Pipes

[View date and time troubleshooting →](/sql-reference/functions-troubleshooting/date-and-time)

### String manipulation

Common issues with string operations:

- **ILLEGAL_TYPE_OF_ARGUMENT** - Non-string data passed to string functions
- **BAD_ARGUMENTS** - String index out of bounds
- **UTF-8 encoding** - Special character handling
- **String concatenation** - Type conversion issues

[View string manipulation troubleshooting →](/sql-reference/functions-troubleshooting/string-manipulation)

### Array operations

Common issues with array functions:

- **SIZES_OF_ARRAYS_DONT_MATCH** - Arrays of different lengths
- **ZERO_ARRAY_OR_TUPLE_INDEX** - 0-based indexing (should be 1-based)
- **Nested arrays** - Complex nested structure handling
- **Array type mismatches** - Mixed element types

[View array operations troubleshooting →](/sql-reference/functions-troubleshooting/array-operations)

### Join keys and aliases

Common issues with joins and aliases:

- **INVALID_JOIN_ON_EXPRESSION** - Incorrect join conditions
- **AMBIGUOUS_COLUMN_NAME** - Same column name in multiple tables
- **Type mismatches** - Different data types in join keys
- **Nullable join keys** - Handling null values in joins

[View join keys and aliases troubleshooting →](/sql-reference/functions-troubleshooting/join-keys-and-aliases)

## Common patterns

### Type conversion issues

Many function errors stem from type conversion problems:

1. **Check data types** - Use `toTypeName()` to verify types
2. **Use safe conversions** - Use `toTypeOrNull()` functions
3. **Handle nulls explicitly** - Check for null values before operations
4. **Validate inputs** - Ensure data meets function requirements

### Performance considerations

Function usage can impact performance:

1. **Pre-calculate in data sources** - Do heavy operations in data sources
2. **Use intermediate columns** - Break down complex operations
3. **Avoid chaining** - Limit function chaining in queries
4. **Monitor resource usage** - Watch for memory and CPU impact

## Best practices

1. **Always validate inputs** - Check data types and values before function calls
2. **Use safe functions** - Prefer functions that handle errors gracefully
3. **Test with sample data** - Verify function behavior with real data
4. **Document function usage** - Keep track of function patterns and solutions
5. **Monitor performance** - Watch for function-related performance issues

## Related documentation

- [SQL functions reference](/sql-reference/functions)
- [Data types](/sql-reference/data-types)
- [Common error patterns](/forward/dev-reference/common-error-patterns)
- [ClickHouse errors](/sql-reference/clickhouse-errors)
