FlowiseAI/Flowise

[QUESTION] [BUG] 500 Internal Server Error When Creating Chatflow via API: Unexpected Token Error

Closed this issue · 1 comments

Describe the bug

When attempting to create a new chatflow using the Flowise API, I receive a 500 Internal Server Error with the following message:
Error: chatflowsService.saveChatflow - Unexpected token u in JSON at position 0

To Reproduce
Steps to reproduce the behavior:

Start the Flowise server using npx flowise start on the default port or a custom port.
Send a POST request to the /api/v1/chatflows endpoint with the following curl command:
curl -L \ -X POST \ -H 'Authorization: Bearer JWT' \ -H 'Content-Type: application/json' \ http://localhost:3000/api/v1/chatflows \ -d '{"name": "Test Chatflow", "description": "This is a test chatflow created via API."}'
Observe that the server responds with a 500 Internal Server Error and the message :

Error: chatflowsService.saveChatflow - Unexpected token u in JSON at position 0

Expected behavior
I expect the server to successfully create a new chatflow based on the provided data, or at least return a clear error message indicating which fields are missing or incorrectly formatted.

Screenshots
N/A (since this issue is encountered via the API and not the UI)

Flow
N/A (since the issue is occurring when trying to create a new chatflow and not while interacting with an existing flow)

Setup

  • Installation npx flowise start`
  • flowise/2.1.2 linux-x64 node-v18.20.4
    
  • OS: Linux
  • Browser [chrome, safari]

Additional context

  • I have confirmed that the API key being used is valid and correctly included in the request.
  • I have tried sending a minimal payload with only a name field, but the same error persists.
  • Reviewing the Flowise server logs did not provide further insights beyond the Unexpected token u in JSON error.

you might need to have an empty flowData like {}
image