# Hi, I'm getting this error when I try to upsert my document embeddings..."The argument to upsert had type errors: item at index 0 of the 'values' array must be number". Please could anyone take a look at it

**URL:** <https://community.pinecone.io/t/hi-im-getting-this-error-when-i-try-to-upsert-my-document-embeddings-the-argument-to-upsert-had-type-errors-item-at-index-0-of-the-values-array-must-be-number-please-could-anyone-take-a-look-at-it/4018>\
**Category:** Support\
**Created:** [January 9, 2024, 5:38pm UTC](https://community.pinecone.io/t/hi-im-getting-this-error-when-i-try-to-upsert-my-document-embeddings-the-argument-to-upsert-had-type-errors-item-at-index-0-of-the-values-array-must-be-number-please-could-anyone-take-a-look-at-it/4018 "2024-01-09T17:38:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luwaservices](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/luwaservices/32/1864_2.png) [@luwaservices](https://community.pinecone.io/u/luwaservices)\
**Post date:** [January 9, 2024, 5:38pm UTC](https://community.pinecone.io/t/hi-im-getting-this-error-when-i-try-to-upsert-my-document-embeddings-the-argument-to-upsert-had-type-errors-item-at-index-0-of-the-values-array-must-be-number-please-could-anyone-take-a-look-at-it/4018/1 "2024-01-09T17:38:39Z")

</div>

Here is the code that is performing the embedding and the upserting:

```auto
const updatePineconeVectorStore = async (client, indexName, docs, embeddings) => {
    const index = client.Index(indexName);
    const splitter = new RecursiveCharacterTextSplitter();
    const queue = [];

    try {
        const splitDocs = await splitter.splitDocuments(docs);

        // Loop over splitDocs and enqueue each splitDoc into a queue
        for (let splitDoc of splitDocs) {
            queue.push(splitDoc);
        }

        const batchSize = 6;

        while (queue.length > 0) {
            //Extract a batch of document from the queue
            const batch = queue.slice(0, batchSize);

            //Construct vector and perform upsert operations for the current batch
            const vectors = await Promise.all(batch.map(async (splitDoc, idx) => {
                const splitDocEmbeddings = await embeddings.embedDocuments(
                    splitDoc.pageContent.replace(/\n/g, " ").split(",")
                );

                return {
                    id: `${splitDoc.metadata.source}_${idx}`,
                    values: splitDocEmbeddings,
                    metadata: {
                        ...splitDoc.metadata,
                    },
                };
            }));

            await index.upsert(vectors);

            console.log(`Processed batch of ${batch.length} documents. Remaining queue size: ${queue.length}`);
        }
    } catch (err) {
        console.error("Error occurred during document processing:", err.message);
    }
};

```

Here is how one of the documents objects in the `vectors` array looks like:  
 ![ar](https://us1.discourse-cdn.com/flex020/uploads/pinecone/original/2X/d/d672a8a1049764aa0ed185252ebc2a24e9e31cf3.png)

---

<div class="post-metadata">

**Author:** ![silas](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/silas/32/1337_2.png) [@silas](https://community.pinecone.io/u/silas)\
**Post date:** [January 9, 2024, 6:06pm UTC](https://community.pinecone.io/t/hi-im-getting-this-error-when-i-try-to-upsert-my-document-embeddings-the-argument-to-upsert-had-type-errors-item-at-index-0-of-the-values-array-must-be-number-please-could-anyone-take-a-look-at-it/4018/2 "2024-01-09T18:06:13Z")

</div>

Hi there, the `values` parameter expects an array of numbers like:

```javascript
values: [0.1, 0.2, 0.3, ...]

```

but looks like you’re passing an array that contains an array, like:

```javascript
values: [[ 0.1, 0.2, 0.3, ...] ]

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![luwaservices](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/luwaservices/32/1864_2.png) [@luwaservices](https://community.pinecone.io/u/luwaservices)\
**Post date:** [January 15, 2024, 11:46pm UTC](https://community.pinecone.io/t/hi-im-getting-this-error-when-i-try-to-upsert-my-document-embeddings-the-argument-to-upsert-had-type-errors-item-at-index-0-of-the-values-array-must-be-number-please-could-anyone-take-a-look-at-it/4018/3 "2024-01-15T23:46:25Z")

</div>

ohh… thanks that did it.

---

<div class="post-metadata">

**Author:** ![silas](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/silas/32/1337_2.png) [@silas](https://community.pinecone.io/u/silas)\
**Post date:** [January 16, 2024, 5:25pm UTC](https://community.pinecone.io/t/hi-im-getting-this-error-when-i-try-to-upsert-my-document-embeddings-the-argument-to-upsert-had-type-errors-item-at-index-0-of-the-values-array-must-be-number-please-could-anyone-take-a-look-at-it/4018/4 "2024-01-16T17:25:42Z")

</div>

@luwaservices, glad to hear that

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/pinecone/original/1X/d16664eba369eeee623700cf12feab5562b37eaf.jpeg) [@system](https://community.pinecone.io/u/system)\
**Post date:** [January 22, 2024, 9:42pm UTC](https://community.pinecone.io/t/hi-im-getting-this-error-when-i-try-to-upsert-my-document-embeddings-the-argument-to-upsert-had-type-errors-item-at-index-0-of-the-values-array-must-be-number-please-could-anyone-take-a-look-at-it/4018/5 "2024-01-22T21:42:25Z")

</div>

Closed on January 22, 2024, 9:42pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
