langflow-ai/langflow · error · HTTPException

An internal error occurred while listing flows.

Error message

An internal error occurred while listing flows.

What it means

Catch-all 500 from GET /api/v1/flows/: an unexpected exception escaped the listing pipeline — folder lookups, the SQL prefilter union with the authorization plugin, pagination, or filter_visible_resources/batch_enforce. Unlike most handlers here, this one logs the full traceback ('Error listing flows') and returns a generic message that does NOT leak str(e), and the original exception is chained.

Source

Thrown at src/backend/base/langflow/api/v1/flows.py:259

        # was applied before pagination, so ``page.total`` is accurate; the OSS
        # fallback narrows ``page.items`` in memory and ``page.total`` may
        # overcount denied rows (unchanged from before).
        if visible_flow_ids is None:
            page.items = await filter_visible_resources(
                current_user,
                resource_type="flow",
                candidates=list(page.items),
                domain_extractor=lambda flow: _resolve_authz_domain(flow.workspace_id, flow.folder_id),
                owner_extractor=lambda flow: flow.user_id,
                act=FlowAction.READ,
            )
        return page  # noqa: TRY300 — final return inside try matches the existing style of this handler

    except Exception as e:
        import logging as _logging

        _logging.getLogger(__name__).exception("Error listing flows")
        raise HTTPException(status_code=500, detail="An internal error occurred while listing flows.") from e


@router.get("/{flow_id}", response_model=FlowRead, status_code=200)
async def read_flow(
    *,
    flow_id: UUID,  # noqa: ARG001
    flow: AuthorizedReadFlow,
):
    """Read a flow."""
    return FlowRead.model_validate(flow, from_attributes=True)


@router.get("/{flow_id}/note_translations", status_code=200)
async def get_note_translations(
    *,
    flow_id: UUID,  # noqa: ARG001
    flow: AuthorizedReadFlow,
    request: Request,

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Read the server log — the `Error listing flows` traceback identifies the exact failure point
  2. If an authorization plugin is enabled, check its logs/registration (entry point authorization_service) and temporarily set LANGFLOW_AUTHZ_ENABLED=false to isolate
  3. Audit for corrupt flow/folder rows (null user_id/workspace_id anomalies) if the traceback points at serialization
  4. Retry after fixing the underlying cause; the endpoint is read-only so retries are safe
Defensive patterns

Strategy: try-catch

Try / catch

catch (e) {
  if (e.response?.status === 500 && /internal error while listing flows/.test(e.response.data?.detail))
    return showErrorWithServerLogHint();
  throw e;
}

Prevention

When it happens

Trigger: Authorization-plugin misbehavior during batch_enforce (plugin raises), malformed Flow rows that break pagination serialization, database driver errors mid-query, or bugs in the prefilter SQL against a plugin-returned id list.

Common situations: Enabling LANGFLOW_AUTHZ_ENABLED with a partially-implemented plugin; corrupt flow rows (null/bad columns) in older databases; DB failover during the request.

Related errors


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