# What does this error mean and how do I fix it? Invalid ‘content’: array too long

**URL:** <https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132>\
**Category:** Bugs\
**Tags:** api\
**Created:** [May 10, 2024, 8:23pm UTC](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132 "2024-05-10T20:23:59Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![tarunadityaselva](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@tarunadityaselva](https://community.openai.com/u/tarunadityaselva)\
**Post date:** [May 13, 2024, 2:31pm UTC](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132/23 "2024-05-13T14:31:08Z")

</div>

Openai, please FIX THIS ASAP. literally broke production system because some stupid bug

---

<div class="post-metadata">

**Author:** ![DavidOS366](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/davidos366/32/432385_2.png) [@DavidOS366](https://community.openai.com/u/DavidOS366)\
**Post date:** [May 13, 2024, 2:45pm UTC](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132/24 "2024-05-13T14:45:02Z")

</div>

> [@tarunadityaselva](#):
>
> Openai, please FIX THIS ASAP. literally broke production system because some stupid bug

You used a beta thing in production? WoW

---

<div class="post-metadata">

**Author:** ![wclayf](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/wclayf/32/184514_2.png) [@wclayf](https://community.openai.com/u/wclayf)\
**Post date:** [May 13, 2024, 3:42pm UTC](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132/25 "2024-05-13T15:42:33Z")

</div>

I bet this has to do with how some Windows machines handle the newline character differently to other systems. There used to be a “\n\r” (new line, carriage return) issue. Probably a simple string replacement, inside the OpenAI to fix the harmful patterns. I would suggest taking one of the text blocks that fails (a short one if possible) and viewing it in a HexEditor to display the raw bytes, so you can show the OpenAI team what it really contains. If you just send them text examples that may not work to help them replicate the issue. They need the exact bytes, if that makes sense.

_UPDATE: Based on re-reading the other comments, it seems like this might be genuinely a limit of 10 paragraphs somewhere in the code, and not the “newline format” that I was speculating about above._

---

<div class="post-metadata">

**Author:** ![szaslavsky](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@szaslavsky](https://community.openai.com/u/szaslavsky)\
**Post date:** [May 13, 2024, 4:31pm UTC](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132/26 "2024-05-13T16:31:55Z")

</div>

A few hours ago I posted the same issue at the link below with easy-to-reproduce instructions

> [@Assistants Playground - error pasting multiline text](https://community.openai.com/t/assistants-playground-error-pasting-multiline-text/743939):
>
> Since Friday, there is an error when I click the “Run” button in the assistants playground after pasting text that is longer than 10 lines. To duplicate the problem, use any assistant, enter 1…11 on separate lines, while pressing “enter” after each number. Then click “Run”. The error is “Error assing message: Invalid ‘content’: array too long. Expected an array with maximum length of 10, but got an array with length 11 instead”. This appears to be a client-side javascript error because I do…

---

<div class="post-metadata">

**Author:** ![arunvashishtha](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/arunvashishtha/32/147342_2.png) [@arunvashishtha](https://community.openai.com/u/arunvashishtha)\
**Post date:** [June 15, 2024, 7:35pm UTC](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132/27 "2024-06-15T19:35:44Z")

</div>

I am getting this same error using Assistant API while creating the message on a thread. Using postman to test the API and just posting “Hi” is getting me this error

---

<div class="post-metadata">

**Author:** ![doufulai](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/doufulai/32/370387_2.png) [@doufulai](https://community.openai.com/u/doufulai)\
**Post date:** [September 19, 2024, 12:10am UTC](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132/28 "2024-09-19T00:10:58Z")

</div>

I am getting the same issue here when I add a lot of file ids using the client.beta.threads.create

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [September 19, 2024, 6:57am UTC](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132/29 "2024-09-19T06:57:57Z")

</div>

Ensure you are using the attachments parameter and not the file\_ids parameter of v1, and that you have the latest version of the API SDK library or are sending v2 headers.

If the destination parameter is attachments → tools → type: file\_search, then I can find no limit documented besides that of a vector store itself, whereas code interpreter has a limit and so did v1’s retrieval where files were sent both to the document store and to code interpreter.

---

<div class="post-metadata">

**Author:** ![shahinfasihi](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/shahinfasihi/32/467159_2.png) [@shahinfasihi](https://community.openai.com/u/shahinfasihi)\
**Post date:** [September 24, 2024, 1:20pm UTC](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132/30 "2024-09-24T13:20:15Z")

</div>

hey I had the same issue and split the content into chunks of 10 items each  
then create the message for each chunk

```auto
content_chunks = [content[i:i + 10] for i in range(0, len(content), 10)]
    for chunk in content_chunks:
        client.beta.threads.messages.create(
            thread_id=thread_id,
            role="user",
            content=chunk
        )

```

[Previous page](https://community.openai.com/t/what-does-this-error-mean-and-how-do-i-fix-it-invalid-content-array-too-long/742132.md?page=1)
