Error 36: BAD_ARGUMENTS
This error occurs when a function or table function is called with an incorrect number of arguments or with arguments of incompatible types. It typically indicates that parameters provided to a function don't match what the function expects.
Most common causes
-
Wrong Number of Arguments
- Providing too many or too few arguments to a function
- Misunderstanding function signature requirements (e.g., some functions expect arrays instead of multiple scalar arguments)
- Table functions like
s3Cluster,file,url,mysqlreceiving incorrect argument counts
-
Incorrect Argument Types
- Passing a scalar value when an array is expected
- Type mismatch between provided and expected parameters
- Numeric types where strings are expected, or vice versa
-
Function Signature Confusion
- Functions with overloaded signatures (accepting different argument counts)
- Misreading documentation about optional vs required parameters
- Using old syntax for functions that have been updated
-
Table Function Argument Issues
- S3, file, URL, and remote table functions have specific argument order requirements
- Missing required arguments like format or structure specifications
- Extra arguments beyond what the function supports
Common solutions
1. Check Function Documentation
Always verify the correct function signature in the ClickHouse reference documentation. Pay attention to:
- Number of required vs optional arguments
- Argument types (scalars vs arrays)
- Argument order
2. Use Arrays for Multi-Value Functions
Many functions expect arrays rather than multiple scalar arguments:
3. Verify Table Function Arguments
For table functions, ensure you're providing arguments in the correct order:
4. Check for Missing Required Arguments
Some functions have mandatory parameters that cannot be omitted:
5. Use DESCRIBE or EXPLAIN to Validate
Test your query structure before execution:
6. Review Error Message for Hints
The error message often indicates what was expected:
This tells you the function needs exactly 2 arguments, not 5.
Common function-specific issues
Window Functions
tumble(),hop(),tumbleStart()require both timestamp and interval arguments- Missing interval is a common mistake
Search Functions
multiSearchAny(),multiSearchAllPositions()expect an array as the second argument- Docs examples may sometimes show incorrect syntax
Table Functions
s3Cluster()- Expects 1 to 6 arguments (varies by version)generateRandom()- Check structure specification- Remote table functions - Verify connection parameters
Prevention tips
- Consult Documentation First: Always check the official ClickHouse docs for function signatures
- Use IDE/Editor with ClickHouse Support: Many editors can validate function calls
- Test in Development: Validate queries in a non-production environment first
- Keep ClickHouse Updated: Function signatures may change between versions
- Use
EXPLAINQueries: Helps catch argument errors before execution
If you're experiencing this error:
- Check the exact error message for what was passed vs what was expected
- Review the function documentation for correct signature
- Verify you're using arrays where required (not multiple scalar arguments)
- Ensure all required arguments are provided in the correct order
- Check if your ClickHouse version supports the function signature you're using