langflow-ai/langflow · error · HTTPException

An internal error occurred while creating the flow.

Error message

An internal error occurred while creating the flow.

What it means

HTTP 500 catch-all in _create_flow: an unexpected, non-validation, non-HTTP exception escaped flow creation (DB errors during flush/refresh, filesystem failure not wrapped earlier, programming errors). The real traceback goes to logger.exception("Error creating flow"); the client gets a generic message so internals are not leaked.

Source

Thrown at src/backend/base/langflow/api/v1/flows_helpers.py:354

        if effective_id is not None:
            db_flow.id = effective_id

        db_flow.updated_at = datetime.now(timezone.utc)
        await _validate_and_assign_folder(session, db_flow, user_id)

        session.add(db_flow)
        await session.flush()
        await session.refresh(db_flow)
        await _save_flow_to_fs(db_flow, user_id, storage_service)

        return FlowRead.model_validate(db_flow, from_attributes=True)
    except Exception as e:
        if hasattr(e, "errors"):
            raise HTTPException(status_code=400, detail=str(e)) from e
        if isinstance(e, HTTPException):
            raise
        logger.exception("Error creating flow")
        raise HTTPException(status_code=500, detail="An internal error occurred while creating the flow.") from e


async def _read_flow(
    session: AsyncSession,
    flow_id: UUID,
    user_id: UUID,
):
    """Read a flow.

    When the registered authorization service supports cross-user fetch
    (authorization plugin), the row is loaded by id alone and the caller's
    ``ensure_flow_permission`` decides access. Otherwise the query stays
    owner-scoped so the OSS pass-through default cannot widen visibility.
    """
    from langflow.services.authorization.fetch import authorized_or_owner_scoped

    return await authorized_or_owner_scoped(
        session,

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Read the server log around 'Error creating flow' — the logged traceback names the root cause; the HTTP message is intentionally generic.
  2. Apply pending migrations (make alembic-upgrade) after upgrades.
  3. For race conditions on endpoint_name, retry with a unique name or after the conflicting request commits.
  4. Verify DB connectivity and that the flows table schema matches the models.
Defensive patterns

Strategy: retry

Try / catch

try { await createFlow(body) } catch (e) { if (e.status === 500) { checkServerLog('Error creating flow'); retryOnceAfterDbCheck(); } }

Prevention

When it happens

Trigger: Database down or constraint violation not surfaced as IntegrityError earlier (race on unique endpoint_name), flush failing on serialization of a column, _save_flow_to_fs raising an unexpected non-OSError, or a bug in a create-path hook.

Common situations: DB connection dropped mid-request; two concurrent creates racing on a unique index; a schema/code version mismatch after a partial upgrade (migration not applied); exotic fs_path errors that bypass the OSError branch.

Related errors


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