Flowise icon indicating copy to clipboard operation
Flowise copied to clipboard

Get chatflow by ID endpoint returns 500 when it should return 4xx

Open salimzdn opened this issue 3 months ago • 2 comments

Describe the bug

The chatflow API does not work as expected and as described in the documentation.

When getting chatflow by ID, with an invalid id, or a not existing id, instead of receiving a 400 or a 404 status code, status code is 500 with the following response

{ "statusCode": 500, "success": false, "message": "Error: chatflowsService.getChatflowById - Chatflow e not found in the database!", "stack": {} }

To Reproduce

Getting chatflow by ID, with an invalid id

  1. Use chatflow - Get chatflow by ID endpoint : .../chatflows/invalid-id
  2. Response is an error with statusCode 500 instead of 400

Getting chatflow by ID, with a not existing id

  1. Use chatflow - Get chatflow by ID endpoint : .../chatflows/dafb70a2-c258-4a36-ae81-2a401c7cd147 (where no chatflow has this id)
  2. Response is an error with statusCode 500 instead of 404

Expected behavior

Getting chatflow by ID, with an invalid id

  • Expected statusCode is 400

Getting chatflow by ID, with a not existing id

  • Expected statusCode is 404

Screenshots

No response

Flow

No response

Use Method

None

Flowise Version

No response

Operating System

None

Browser

None

Additional context

No response

salimzdn avatar Oct 27 '25 14:10 salimzdn

This PR should fix it

aibysid avatar Nov 08 '25 19:11 aibysid

I would add that this error also happens for many APIs and not only for the chatflow API, a more global fix could be applied

salimzdn avatar Nov 10 '25 06:11 salimzdn