batch insert fails the whole batch with "ValueError: Unexpected type" when a value is a Decimal

Abierto
#2,263 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@steven-asearcy ya está trabajando en esto.

Desde el 18/11/2026.

  • #2264 de @steven-asearcy — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Start with _serialize_primitive in collections/batch/grpc_batch.py and compare its handling of unsupported values with the data.insert error described in the issue. Check the existing batch serialization tests and add coverage for decimal.Decimal and numpy.float32; done means these values produce a clear WeaviateInvalidInputError. Pull request #2264 is already open for this issue.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

ran into this in a singer target. the singer sdk parses json numbers as decimal.Decimal, and postgres numeric columns come back as Decimal through psycopg too, so probably not just me.

data.insert gives a clear error:

WeaviateInvalidInputError: Invalid input provided: Cannot serialize value of type <class 'decimal.Decimal'> to Weaviate..

the grpc paths don't. insert_many raises ValueError: Unexpected type from inside protobuf, and the batch context managers just log it. every object in that batch ends up in failed_objects, including the good ones:

with col.batch.fixed_size(batch_size=100) as batch:
    for i in range(99):
        batch.add_object({"price": float(i)})
    batch.add_object({"price": Decimal("9.99")})

len(col.batch.failed_objects)  # 100
len(col)                       # 0

the message doesn't say which property or type it was, so it's hard to track down.

cause is _serialize_primitive in collections/batch/grpc_batch.py. it passes anything it doesn't handle straight to Struct.update. numpy.float32 hits the same thing.

weaviate-client 4.24.1, weaviate 1.40.5, python 3.13

i'll put up a PR that raises the same WeaviateInvalidInputError as data.insert. one bad value would still fail the whole batch after that, which felt like a bigger change so i left it alone. can take a look at that too if you want.

Lenguaje dominante
Python
Estrellas
230
Forks
173
Merge medio
4 d 16 h
PR fusionados (30 d)
23

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de weaviate/weaviate-python-client

Todos los issues de weaviate/weaviate-python-client

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.