NEW

Pulse 2025 Product Roundup: From Monitoring to AI-Native Control Plane

ClickHouse DB::Exception: Data type cannot have arguments

The "DB::Exception: Data type cannot have arguments" error appears when you supply parameters to a ClickHouse type that does not accept them. For example, writing String(255) or Int32(10) — these types have no parameterization in ClickHouse, unlike some other databases where VARCHAR(255) or INT(10) are common.

Impact

The CREATE TABLE, ALTER, or CAST statement fails. This is a simple syntax issue that's quick to fix once you understand which ClickHouse types accept parameters and which don't.

Common Causes

  1. Porting schemas from MySQL/PostgreSQL — writing String(255) (from VARCHAR(255)), Int32(11) (from INT(11)), or Float64(10,2).
  2. Adding unnecessary parenthesesDate() or UUID() with empty parentheses where none are needed.
  3. Confusing FixedString and StringString(N) is not valid; use FixedString(N) for fixed-width strings.
  4. Using the wrong Decimal syntaxDecimal64 requires one parameter (scale), not zero: Decimal64(4).
  5. ORM or tool generating incorrect DDL — automated schema generators may add parameters to types that don't support them.

Troubleshooting and Resolution Steps

  1. Remove the parameters from non-parametric types:

    -- Wrong
    CREATE TABLE t (name String(255), age Int32(10)) ENGINE = MergeTree() ORDER BY tuple();
    
    -- Correct
    CREATE TABLE t (name String, age Int32) ENGINE = MergeTree() ORDER BY tuple();
    
  2. Use FixedString(N) if you need a fixed-width string:

    -- For fixed-width data like country codes
    CREATE TABLE t (country_code FixedString(2)) ENGINE = MergeTree() ORDER BY tuple();
    
  3. Check which types accept parameters. Here's a quick reference:

    Accepts parameters Does not
    FixedString(N) String
    Decimal(P, S) Int32, UInt64, etc.
    DateTime64(precision) Date, DateTime
    Enum8(...), Enum16(...) Float32, Float64
    Array(T), Nullable(T) UUID, IPv4, IPv6
  4. Remove empty parentheses:

    -- Wrong
    CREATE TABLE t (id UUID()) ENGINE = MergeTree() ORDER BY id;
    
    -- Correct
    CREATE TABLE t (id UUID) ENGINE = MergeTree() ORDER BY id;
    
  5. When migrating from MySQL, use this type mapping:

    • VARCHAR(N) / TEXT -> String
    • CHAR(N) -> FixedString(N) or String
    • INT(11) -> Int32
    • DOUBLE(10,2) -> Float64 or Decimal(10,2)

Best Practices

  • When migrating schemas from other databases, strip type parameters that ClickHouse doesn't support rather than trying to translate them literally.
  • Review the ClickHouse type documentation for each type's exact syntax before writing DDL.
  • If using an ORM, verify it has a proper ClickHouse dialect that generates correct type syntax.
  • Use String instead of FixedString unless you have a specific need for fixed-width storage.

Frequently Asked Questions

Q: Why doesn't ClickHouse String accept a length parameter like VARCHAR?
A: ClickHouse String is a variable-length type with no maximum length constraint. There is no need for a length parameter because ClickHouse handles string storage differently than row-oriented databases. If you need fixed-width storage, use FixedString(N).

Q: Can I enforce a maximum string length in ClickHouse?
A: Not through the type system. You can use a CHECK constraint or validate in your application layer. Alternatively, use FixedString(N) which enforces an exact byte width.

Q: What about DateTime — can I pass a timezone parameter?
A: Yes, DateTime('UTC') and DateTime64(3, 'UTC') are valid. The timezone is a valid parameter for DateTime types. The error occurs only when you add parameters to types that genuinely don't accept any.

Q: Does this error affect CAST expressions too?
A: Yes. CAST(x AS String(255)) will trigger the same error. Use CAST(x AS String) instead.

Subscribe to the Pulse Newsletter

Get early access to new Pulse features, insightful blogs & exclusive events , webinars, and workshops.

We use cookies to provide an optimized user experience and understand our traffic. To learn more, read our use of cookies; otherwise, please choose 'Accept Cookies' to continue using our website.