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

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

You used a beta thing in production? WoW

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.

1 Like

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

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

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

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.

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

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
        )