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

Crash when loading flows on startup - 'str' object has no attribute 'hex' #5370

Open
devinbost opened this issue Dec 19, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@devinbost
Copy link
Contributor

devinbost commented Dec 19, 2024

Bug Description

Hitting this exception when loading a flow on startup:

INFO     2024-12-18 20:32:01 - INFO     - setup - Loading flow from file: INIT_6.1_clean.json                                                                           setup.py:558
ERROR    2024-12-18 20:32:01 - ERROR    - deps - An error occurred during the session scope.Traceback (most recent call last):                                           deps.py:203
                                                                                                                                                                                    
           File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1815, in _execute_context                                                                 
             context = constructor(                                                                                                                                                 
                       -> <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.sqlite.aiosqlite.SQLiteExecutionContext_a...                          
           File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 1476, in _init_compiled                                                                
             flattened_processors(compiled_params)                                                                                                                                  
             |                         -> {'id_1': '4d4388cf-052b-4bdc-b51f-e07630d34a2d'}                                                                                          
             -> {'id_1': <function Uuid.bind_processor.<locals>.process at 0xffff10dbe520>}                                                                                         
           File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/sql/sqltypes.py", line 3631, in process                                                                         
             value = value.hex                                                                                                                                                      
                     -> '4d4388cf-052b-4bdc-b51f-e07630d34a2d'                                                                                                                      
                                                                                                                                                                                    
         AttributeError: 'str' object has no attribute 'hex'  

The flow was exported using the same version of LangFlow (though it was initially imported from an earlier version).
I've hit this in a couple of different versions of LangFlow but most recently in langflowai/langflow-ep:v1.1.1.dev11.

More detailed log is here:

docker-compose-sqlite2.log

Reproduction

  1. Create a ./flows directory and put this flow in it:
    Ingest_6.5_clean.json
    (Note that this flow was created with this latest version of LangFlow. I've tried others as well and still hit the same exception.)

  2. Start LangFlow with this docker-compose.yaml file:

version: "0.4.12"

networks:
  langflow-network:
    driver: bridge

services:
  langflow:
    image: langflowai/langflow-ep:v1.1.1.dev11 
    ports:
      - "7860:7860"
    command: ["langflow", "run", "--env-file", "/app/.env", "--host", "0.0.0.0", "--port", "7860"]
    working_dir: /app
    environment:
      - LANGFLOW_LOAD_FLOWS_PATH=/app/flows
      - COLUMNS=200
    volumes:
      - ./langflow-tmp/langflow-data:/app/langflow
      - ./langflow-tmp/langflow-app-data:/app/data
      - ./huggingface:/app/huggingface
      - ./.env.development:/app/.env
      - ./flows:/app/flows
    networks:
      - langflow-network

Expected behavior

LangFlow should start normally and load the flow file without exceptions.

Who can help?

@jordanrfrazier

Operating System

M1 Mac

Langflow Version

langflowai/langflow-ep:v1.1.1.dev11

Python Version

3.10

Screenshot

No response

Flow File

(Link is above)

@devinbost devinbost added the bug Something isn't working label Dec 19, 2024
Copy link

dosubot bot commented Dec 19, 2024

The error you're encountering, 'str' object has no attribute 'hex', suggests that a string is being processed where a UUID object is expected. This typically happens when the system attempts to call the hex method on a string, which is not valid.

Here are a few steps you can take to troubleshoot and potentially resolve this issue:

  1. Check UUID Handling: Ensure that the UUIDs in your flow file are being correctly handled as UUID objects rather than strings. This might involve checking the code where UUIDs are processed to ensure they are converted to UUID objects using Python's uuid module.

  2. Flow File Compatibility: Since the flow was initially imported from an earlier version, there might be compatibility issues. LangFlow 1.0 introduced several changes, including how flows are structured and processed [1]. Ensure that your flow file is compatible with the current version by following any migration guides provided by LangFlow.

  3. Database Interaction: Verify that the database interactions are correctly handling UUIDs. The expected data type for UUIDs in LangFlow's database interactions is UUID, and the system should ensure correct type handling by using the UUID type from Python's uuid module [2].

  4. Update LangFlow: If possible, try updating to the latest version of LangFlow, as there might be bug fixes or improvements related to UUID handling.

  5. Review Logs: Check the detailed logs you provided for any additional context or errors that might give more insight into where the issue is occurring.

If these steps do not resolve the issue, you may need to look into the specific code handling UUIDs in your setup or consult any recent changes in the LangFlow codebase that might affect UUID processing.

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

2 participants