Skip to content

ClickHouse INCORRECT_DATA Error on Fresh Install with JSON Column Type #559

@ihsanovali

Description

@ihsanovali

A fresh installation fails to ingest data into ClickHouse, resulting in a DB::Exception: Cannot parse JSON object here error. The issue occurs when the props column in the events table is set to the JSON data type. This leads to a type mismatch that halts the data ingestion process. The problem has been reproduced on a fresh deployment using docker-compose.

Reproduction

Environment:

  • Checkout tag v1.5.1 (also tried on latest commit 2c54b0e)
  • docker compose up -d --build
  • ClickHouse Docker Image: clickhouse/clickhouse-server:25.4.2
  • Docker Compose configuration with enable_json_type: 1

Steps to Reproduce:

  • Start the application services using the provided docker-compose.yml.
  • Ensure the ClickHouse events table is created with the props column as JSON.
  • Trigger an event by making the following API call.
http://localhost:4200/api/v1/analytics/api/track
POST /api/v1/analytics/api/track HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Content-Length: 327
Content-Type: application/json
Host: localhost:4200
Origin: http://localhost:4200
Referer: http://localhost:4200/home
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
sec-ch-ua: "Chromium";v="139", "Not;A=Brand";v="99"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Linux"

Request payload:

{
  "site_id": "1",
  "hostname": "localhost",
  "pathname": "/home",
  "querystring": "",
  "screenWidth": 1920,
  "screenHeight": 1080,
  "language": "en-US",
  "page_title": "My Page Title",
  "referrer": "",
  "user_id": "admin",
  "api_key": "rb_xxxxxxxxxxxxxxxxxxxxxxxx",
  "type": "custom_event",
  "event_name": "testEvent",
  "properties": "{\"testing\":\"123\"}"
}

The application responds with a 200 OK success message, but the data fails to ingest into ClickHouse.
Response 200: {"success":true}

Clickhouse Error Message

2025.08.20 07:14:16.746834 [ 65959 ] {d490f144-22bd-411a-9643-e2edeae33105} <Error> executeQuery: Code: 117. DB::Exception: Cannot parse JSON object here: {"testing":"123"}: (while reading the value of key props): (at row 1)
: While executing ParallelParsingBlockInputFormat. (INCORRECT_DATA) (version 25.4.2.31 (official build)) (from 172.18.0.5:59138) (in query: INSERT INTO events FORMAT JSONEachRow ), Stack trace (when copying this message, always include the lines below):

This solves the problem but it breaks functionality of props:

ALTER TABLE events MODIFY COLUMN props String;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions