langflow-ai/langflow · error · HTTPException

Flow not found

Error message

Flow not found

What it means

404 from the flow version API's _get_user_flow helper: every /flows/{flow_id}/versions route first requires a Flow row matching BOTH the flow_id and the current user_id. No such row means the flow does not exist or is owned by someone else — both report the same generic 404. Note this helper is strictly owner-scoped (it does not include the Flow.user_id IS NULL branch used by flow_events).

Source

Thrown at src/backend/base/langflow/api/v1/flow_version.py:83

    result.is_deployed = is_deployed
    return result


def _version_to_read_full(
    entry: FlowVersion, *, strip_keys: bool = False, is_deployed: bool | None = None
) -> FlowVersionReadWithData:
    result = FlowVersionReadWithData.model_validate(entry, from_attributes=True)
    result.is_deployed = is_deployed
    if strip_keys:
        result.data = strip_version_data(result.data)
    return result


async def _get_user_flow(session: AsyncSession, flow_id: UUID, user_id: UUID) -> Flow:
    result = await session.exec(select(Flow).where(Flow.id == flow_id, Flow.user_id == user_id))
    flow = result.first()
    if not flow:
        raise HTTPException(status_code=404, detail="Flow not found")
    return flow


def _translate_version_error(exc: FlowVersionError) -> HTTPException:
    """Translate a domain exception into an HTTPException."""
    if isinstance(exc, FlowVersionSerializationError):
        return HTTPException(status_code=422, detail=str(exc))
    if isinstance(exc, FlowVersionConflictError):
        return HTTPException(status_code=409, detail=str(exc))
    if isinstance(exc, FlowVersionDeployedError):
        return HTTPException(status_code=409, detail=str(exc))
    if isinstance(exc, FlowVersionNotFoundError):
        return HTTPException(status_code=404, detail=str(exc))
    return HTTPException(status_code=500, detail=str(exc))


def _ensure_deployments_enabled_for_provider_id(deployment_provider_id: UUID | None) -> None:
    if deployment_provider_id and not FEATURE_FLAGS.wxo_deployments:

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Verify ownership: GET /api/v1/flows/{flow_id} must succeed for the same user before version endpoints can work
  2. For null-owner flows under AUTO_LOGIN, assign an owner (update user_id) or operate as the user who created them
  3. Re-check the flow_id from the current flows listing rather than a cached value
Defensive patterns

Strategy: validation

Validate before calling

const flow = await axios.get(`/api/v1/flows/${flowId}`); // must succeed first — same owner scope
// then: axios.get(`/api/v1/flows/${flowId}/versions/`)

Try / catch

catch (e) { if (e.response?.status === 404) showFlowUnavailable(); else throw e; }

Prevention

When it happens

Trigger: Any flow-version request (list/create/get/activate/delete) where flow_id belongs to another user, was deleted, or is a null-owner flow (which this helper deliberately does not match even under AUTO_LOGIN).

Common situations: Team deployments where a teammate's flow id is used; null-owner/starter flows created under AUTO_LOGIN that the strict user_id == current_user.id predicate excludes; stale ids after re-importing a database.

Related errors


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