Skip to content

[Bug]: JSON data type checking contains misleading errors. #2886

@zhuwenxing

Description

@zhuwenxing

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

        for i in range(nb):
            # Generate diverse numeric values
            if i % 5 == 0:
                # Some large numbers
                numeric_value = rng.integers(100000, 999999)
            elif i % 3 == 0:
                # Some medium numbers
                numeric_value = rng.integers(1000, 9999)
            else:
                # Regular sequential numbers
                numeric_value = i
            
            nested_value = i * 7 + (i % 13)  # Different pattern for nested
            
            all_numbers.append(numeric_value)
            all_nested_numbers.append(nested_value)
            
            rows.append({
                default_primary_key_field_name: i,
                default_vector_field_name: list(rng.random((1, default_dim))[0]),
                "json_field": {
                    "number": numeric_value,
                    "index": i,
                    "data": {"nested_number": nested_value}
                }
            })
        
        self.insert(client, collection_name, rows)

[2025-07-08 11:58:21 - ERROR - ci_test]: (api_response) : <DataNotMatchException: (code=1, message=The Input data type is inconsistent with defined schema, {json_field} field should be a json, but got a {<class 'dict'>} instead.)> (api_request.py:36)

The root cause of the insert error is likely due to the presence of numpy data types in the JSON data, which cannot be serialized into JSON. However, it triggered a misleading error instead. Our JSON datatype supports the dict class, but this error can cause confusion.

Expected Behavior

No response

Steps/Code To Reproduce behavior

Environment details

- Hardware/Softward conditions (OS, CPU, GPU, Memory):
- Method of installation (Docker, or from source):
- Milvus version (v0.3.1, or v0.4.0):
- Milvus configuration (Settings you made in `server_config.yaml`):

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions