{"record":{"id":"d5f8b0b38b901735","repo":"langflow-ai/langflow","slug":"an-internal-error-occurred-while-listing-flows","errorCode":null,"errorMessage":"An internal error occurred while listing flows.","messagePattern":"An internal error occurred while listing flows\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"src/backend/base/langflow/api/v1/flows.py","lineNumber":259,"sourceCode":"        # was applied before pagination, so ``page.total`` is accurate; the OSS\n        # fallback narrows ``page.items`` in memory and ``page.total`` may\n        # overcount denied rows (unchanged from before).\n        if visible_flow_ids is None:\n            page.items = await filter_visible_resources(\n                current_user,\n                resource_type=\"flow\",\n                candidates=list(page.items),\n                domain_extractor=lambda flow: _resolve_authz_domain(flow.workspace_id, flow.folder_id),\n                owner_extractor=lambda flow: flow.user_id,\n                act=FlowAction.READ,\n            )\n        return page  # noqa: TRY300 — final return inside try matches the existing style of this handler\n\n    except Exception as e:\n        import logging as _logging\n\n        _logging.getLogger(__name__).exception(\"Error listing flows\")\n        raise HTTPException(status_code=500, detail=\"An internal error occurred while listing flows.\") from e\n\n\n@router.get(\"/{flow_id}\", response_model=FlowRead, status_code=200)\nasync def read_flow(\n    *,\n    flow_id: UUID,  # noqa: ARG001\n    flow: AuthorizedReadFlow,\n):\n    \"\"\"Read a flow.\"\"\"\n    return FlowRead.model_validate(flow, from_attributes=True)\n\n\n@router.get(\"/{flow_id}/note_translations\", status_code=200)\nasync def get_note_translations(\n    *,\n    flow_id: UUID,  # noqa: ARG001\n    flow: AuthorizedReadFlow,\n    request: Request,","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/flows.py#L241-L277","documentation":"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.","triggerScenarios":"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.","commonSituations":"Enabling LANGFLOW_AUTHZ_ENABLED with a partially-implemented plugin; corrupt flow rows (null/bad columns) in older databases; DB failover during the request.","solutions":["Read the server log — the `Error listing flows` traceback identifies the exact failure point","If an authorization plugin is enabled, check its logs/registration (entry point authorization_service) and temporarily set LANGFLOW_AUTHZ_ENABLED=false to isolate","Audit for corrupt flow/folder rows (null user_id/workspace_id anomalies) if the traceback points at serialization","Retry after fixing the underlying cause; the endpoint is read-only so retries are safe"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (e) {\n  if (e.response?.status === 500 && /internal error while listing flows/.test(e.response.data?.detail))\n    return showErrorWithServerLogHint();\n  throw e;\n}","preventionTips":["Alert on the server-side 'Error listing flows' log line — the traceback there is the real diagnostic","Test authorization plugins against the list endpoint before enabling them in prod","Keep a database integrity check in CI for legacy flow rows (null columns)"],"tags":["http-500","flows","authorization","error-handling","database"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}