Upsert failing with error TypeError: object of type 'int' has no len()

I am getting following error during index upsert operation but it is not clear to ne which field is causing this error. Can anyone please help me on this?

[ERROR] 2023-05-26T09:59:29.072Z 02e0352d-d1ff-5b96-96f4-69c754d363ef Error: object of type ‘int’ has no len()
Traceback (most recent call last):
File “/var/task/”, line 88, in lambda_handler
dev_index.upsert(vectors = insert_data, namespace = namespace)
File “/opt/python/pinecone/core/utils/”, line 17, in inner_func
return func(*args, **kwargs)
File “/opt/python/pinecone/”, line 147, in upsert
return self._upsert_batch(vectors, namespace, _check_type, **kwargs)
File “/opt/python/pinecone/”, line 233, in _upsert_batch
vectors=list(map(_vector_transform, vectors)),
File “/opt/python/pinecone/”, line 226, in _vector_transform
return Vector(id=id, values=values, metadata=metadata or
, _check_type=_check_type)
File “/opt/python/pinecone/core/client/”, line 49, in wrapped_init
return fn(_self, *args, **kwargs)
File “/opt/python/pinecone/core/client/model/”, line 280, in init = id
File “/opt/python/pinecone/core/client/”, line 188, in setattr
self[attr] = value
File “/opt/python/pinecone/core/client/”, line 488, in setitem
self.set_attribute(name, value)
File “/opt/python/pinecone/core/client/”, line 170, in set_attribute
File “/opt/python/pinecone/core/client/”, line 908, in check_validations
len(input_values) > current_validations[‘max_length’]):
TypeError: object of type ‘int’ has no len()

Hi @amit. What’s the value of insert_data at the time you’re upserting it? How is that variable constructed?

@Cory_Pinecone I was able to guess and fix this. The vector Id value was coming as integer and hence upsert was failing. I am not sure why this field needs to be always treated as string though. But a proper error message will help a lot to fix faster. Thanks