langflow-ai/langflow · error · HTTPException

Session {session_id} not found

Error message

Session {session_id} not found

What it means

Error "Session {session_id} not found" thrown in langflow-ai/langflow.

Source

Thrown at src/backend/base/langflow/api/v1/endpoints.py:1175

        folder_id=flow.folder_id,
    )

    session_service = get_session_service()
    flow_id_str = str(flow.id)
    if outputs is None:
        outputs = []
    if inputs is None:
        inputs = [InputValueRequest(components=[], input_value="")]

    if session_id:
        try:
            session_data = await session_service.load_session(session_id, flow_id=flow_id_str)
        except Exception as exc:
            raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(exc)) from exc
        graph, _artifacts = session_data or (None, None)
        if graph is None:
            msg = f"Session {session_id} not found"
            raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=msg)
    else:
        try:
            # Get the flow that matches the flow_id and belongs to the user
            # flow = session.query(Flow).filter(Flow.id == flow_id).filter(Flow.user_id == api_key_user.id).first()
            stmt = select(Flow).where(Flow.id == flow.id).where(Flow.user_id == api_key_user.id)
            flow = (await session.exec(stmt)).first()
        except sa.exc.StatementError as exc:
            # StatementError('(builtins.ValueError) badly formed hexadecimal UUID string')
            if "badly formed hexadecimal UUID string" in str(exc):
                await logger.aerror(f"Flow ID {flow_id_str} is not a valid UUID")
                # This means the Flow ID is not a valid UUID which means it can't find the flow
                raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
            raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(exc)) from exc
        except Exception as exc:
            raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(exc)) from exc

        if flow is None:
            msg = f"Flow {flow_id_str} not found"

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Verify the session_id exists; sessions expire, so start a new session if needed.
  2. Ensure you are querying the session with the same user that created it.

When it happens

Trigger: Occurs when the session_id supplied in the request does not match any stored session for the flow, e.g. after session expiry or a typo.

Common situations: See trigger scenarios.


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/adb2b344ee66fac5. Report an issue: GitHub.