https://discord.gg/botpress logo
Assistance with “data/messages must be array” when...
# 🤝help
g
Hi Team, I’m running into an error when trying to analyze an image via “Generate Content.” The error returned is: Error: data/messages must be array What I’m doing I’m passing an image URL obtained from my workflow as {{workflow.user_photo_url}}. I expect the model to read the image from that URL and return an analysis. Current request (simplified) { "model": "gpt-4o-mini", "messages": { "role": "user", "content": [ { "type": "text", "text": "Please analyze this image." }, { "type": "image_url", "image_url": { "url": "{{workflow.user_photo_url}}" } } ] } } Error data/messages must be array Suspected cause It looks like the API expects messages to be an array of message objects (not a single object). Also, for image inputs, the content itself must be an array containing both text and the image_url part. Minimal working example I believe should be accepted Chat Completions format: { "model": "gpt-4o-mini", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Please analyze this image." }, { "type": "image_url", "image_url": { "url": "{{workflow.user_photo_url}}" } } ] } ] } If I should be using the Responses API instead, could you confirm the correct equivalent payload? (e.g., the proper input schema with an array of content parts for text + image). Additional details Headers: Content-Type: application/json, Authorization: Bearer The URL resolves to a publicly accessible image (no auth); file type is a standard PNG/JPEG. The templated variable {{workflow.user_photo_url}} expands to a full https URL (I’ve verified it’s not empty). https://cdn.discordapp.com/attachments/1422377361046896701/1422377361315205120/image.png?ex=68dc73a5&is=68db2225&hm=88c9a4180b177673903cd65d31223c96183a49f6d4fde2e7ae5dcbe68122fe72& https://cdn.discordapp.com/attachments/1422377361046896701/1422377361625845790/image.png?ex=68dc73a5&is=68db2225&hm=ef90ad65343c0d021d41285df364b5b1834bed039211c5731dd562170675c89d& https://cdn.discordapp.com/attachments/1422377361046896701/1422377361885761557/SPOILER_image.png?ex=68dc73a5&is=68db2225&hm=4a89f2939fbf751bdae91cab58da39d46846d1f7d7988e1a42f22400082172e3&
Questions Is the above Chat Completions payload the correct/required structure for mixed text + image input? If “Generate Content” is backed by the Responses API in my environment, could you share the exact schema for sending a text prompt plus a remote image URL? Are there any restrictions on image URL domains, redirects, or content types that could cause this error? Thanks in advance for your help! Best regards,
c
It seems like only the following message types are supported: 'text' | 'tool_calls' | 'tool_result' | 'multipart' in the "Generate Content" card https://cdn.discordapp.com/attachments/1422377361046896701/1422520941182980126/image.png?ex=68dcf95d&is=68dba7dd&hm=2cd78e87605b1df78c419ef97ae066c47b905b5a71da86ae9c40dab9c52faf9d&
l
There are some ongoing issues with Generate Content Card, It has been reported to the team 🫡
I found a workaround maybe it could provide some insight @glamorous-planet-66489
You need to enable the vision agent first. - gather url from user - in autonomous node use the "extracted content from image" card - give simple instructions to describe image
g
Thank's! 'text' | 'tool_calls' | 'tool_result' | 'multipart'
I will try!! Thanks
Thank you for the report. I'll give it a try.
Thanks! I was able to successfully convert the image content into text! @careful-nightfall-96364 @white-nest-40686 @loud-crowd-60573 https://cdn.discordapp.com/attachments/1422377361046896701/1422962748660252746/image.png?ex=68de94d4&is=68dd4354&hm=fd6239dafe45b8237953dc1eef5e9ca907ab918e492c76de59dd6fe85e8c0f86&
w
Happy to help you 😉
g
However, next, when I try to send the text information stored in face_analysis_result to generate content, the following error occurs. Error executing card "card:Generate Content" in flow:Main:node:ai_final_recommendation - Ct: data/messages must be array When putting face_analysis_result into messages, how should I process the text information extracted from the image data by OpenAI so that it works correctly? https://cdn.discordapp.com/attachments/1422377361046896701/1422963928190812282/image.png?ex=68de95ed&is=68dd446d&hm=40caf766926818ee26794f3bf81978f9c993d8a488908910542308fe57a166ba& https://cdn.discordapp.com/attachments/1422377361046896701/1422963929113427998/image.png?ex=68de95ee&is=68dd446e&hm=8939efd35f76f62c4d4e7c6c64248dcf30d34fa613894634e5ec19a95e8f6287&
l
Hey @glamorous-planet-66489 the generate content card is not working as intented! So I would avoid using it for now until the fixes are made.
Have you tried using this method?