Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't delete a flow after running it when a playground execution failed #5409

Open
dfleury opened this issue Dec 23, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@dfleury
Copy link

dfleury commented Dec 23, 2024

Bug Description

I can't remove a flow that 1) ran successfully once and 2) thrown an exception later.
It looks like the application state is broken for that flow and the API returns the flowing error:

(psycopg.errors.NotNullViolation) null value in column "flow_id" of relation "vertex_build" violates not-null constraint
DETAIL:  Failing row contains (2024-12-23 14:00:32.353404, ChatInput-WZqts, {"results": {"message": {"text_key": "text", "data": {"timestamp..., {"message": "Hello", "sender": "User", "sender_name": "User", "f..., - Files: []
  Message: Hello
  Sender: User
  Sender Name: User
..., t, null, bc2a8ae8-4e52-4141-baff-ac0587b4fa97).
[SQL: UPDATE vertex_build SET flow_id=%(flow_id)s::UUID WHERE vertex_build.build_id = %(vertex_build_build_id)s::UUID]
[parameters: {'flow_id': None, 'vertex_build_build_id': UUID('bc2a8ae8-4e52-4141-baff-ac0587b4fa97')}]

As you can see, the flow_id is None. However, looking the payload sent over this DELETE request, the id is being passed.
I can't figure out a way to workaround it.

Reproduction

  1. Create a flow (like Basic Prompting) which needs a Global Variables entry
  2. Setup the required global variable in settings
  3. Go to the flow and run it in the playground. The important part here is that the flow runs successfully at least once
  4. Now, go to the settings and remove the variable required by your flow
  5. It's time to break it. Open your flow's playground and test it expecting an exception
  6. After the error appears, go back to the flow's folder and try delete it through to context menu
  7. Even adding the variable again and running the flow, doesn't fix the problem

Expected behavior

I aspect to be able to delete the flow regardless if the flow failed to run.

Who can help?

No response

Operating System

MacOS 15.1.1

Langflow Version

1.5.7

Python Version

3.10

Screenshot

No response

Flow File

No response

@dfleury dfleury added the bug Something isn't working label Dec 23, 2024
Copy link

dosubot bot commented Dec 23, 2024

Hey @dfleury! I'm here to help you with any bugs, questions, or contributions you have for Langflow. Let's tackle this issue together!

To address the issue of not being able to delete a flow in Langflow 1.5.7 due to a "null value in column 'flow_id'" error, you can use the delete_flow function from the API. This function requires a valid flow_id to delete the flow. Here's a brief overview of how it works:

  1. Ensure Valid flow_id: Make sure the flow_id you are passing is valid and exists in the database. The error suggests that the flow_id is None, which might indicate a problem with how the flow is being referenced or stored.

  2. Check Database Consistency: If the flow has been partially deleted or corrupted, manually check the database for inconsistencies. This might involve verifying that the flow_id is correctly associated with the flow in the database.

  3. API Function: The delete_flow function checks if the flow exists and is associated with the current user. If the flow is found, it uses cascade_delete_flow to remove the flow and all related data from the database.

If the flow is not found, the function raises a 404 error indicating "Flow not found". Ensure that the session is properly handling the flow's transactions and that the flow is associated with the correct user [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant