When sending text + image with the API and specifying a session_id, an error occurs.
@Empreiteiro When I send text + image with a specific session_id through the API, I get the error shown in this image. When I send only text, I can get a response without any problem. But when I send text + image together with a session_id, the problem occurs. In the same way, if I send text + image without a session_id, it can process the image correctly.
SO, the issue happens when text + image is used together with a session_id!!! This problem is critical for me and needs to be solved urgently. I checked the code, and the exact source of the error seems to be Langflow.
I must use session_id to isolate users. Also, text works fine, but image fails!!
![]()
Originally posted by @MustafaDUT in #9673
I encountered the same issue, and if i place session id outside the payload (in the tweaks block instead), it will work but end up creating a new default session, which is not a desirable behavior.
If you don’t use a session ID, text + image can be processed — but it happens in the default session. @kcpan-glitch My question to you is this: Is the default case the default Chat screen? Because it also occurs when you don’t use a session_id. Could you share a screenshot of the situation that’s occurring?
@MustafaDUT
Sorry for the belated reply, below see my workaround.
-
Chat Input: The user's text and a static session_id are sent as the primary inputs for each request.
-
Image Uploads: Images are handled by a dedicated workflow. They are first uploaded to the server via a v1 API endpoint. The returned file path is then passed to a custom ImageUploader component for the first stage of processing (Base64).
Hi @kcpan-glitch
- With your custom component, are you able to access the file that was uploaded to that session? 1.1. If yes, after converting it to Base64, how are you using it? 1.1.1 Do you pass it to a Prompt component together with the ChatInput? 1.1.2 Or do you treat this component as a tool, and have your agent call it when needed?
Could you explain the entire workflow step by step? And if possible, could you share a screenshot of the related part of your flow as well?
@MustafaDUT
- the session id never goes to the custom component, it stays with and is stored in the chat input component (the flow is just like uploading a pdf file via file component) 1.1 then i feed it to llm (another custom component) to create an image description as an output 1.1.1 yes, the image description is forwarded to a prompt template, to be joined by the text output from the standard chat input component (again, just like uploading a non-image file) 1.1.2 not a tool (but could be one in a different design), i just have a built-in logic to detect whether or not there is an image being uploaded in the Image Uploader custom component
I understand the process clearly now. In my case, this will be a slow process because there are so many auxiliary agents and sub-tools. Even the normal process can sometimes take a long time.
Thank you so much. This was very informative. @kcpan-glitch
Just add "should_store_message": false in payload as a workaround to avoid "list index out of range" error while sending text + images to Chat Input. Howvere, you will miss this chat in Playground, but it should be ok if you use run flow API.
{
"output_type": "chat",
"input_type": "chat",
"input_value": "Please describe ths image",
"session_id": "session_postman_01",
"tweaks": {
"ChatInput-qOuJh": {
"files": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\2025-11-14_21-16-59_01.png"],
"should_store_message": false
}
}
}
Hi team,
I've created a Pull Request to address this issue (#9859).
The PR implements changes in parse_input_request_from_body to correctly detect and parse multipart/form-data requests, resolving the IndexError that occurred when sending text + image data along with a session_id.
I believe the fix handles both JSON and multipart requests correctly.
Please let me know if any further changes or testing are required!
Thanks, PrathameshJoshi123