langflow-ai/langflow · error · HTTPException

{**primary.to_dict(), "result": result.to_dict()}

Error message

{**primary.to_dict(), "result": result.to_dict()}

What it means

Returned by the extension reload endpoint (POST on /api/v1/extensions .../reload) with HTTP 422 when reloading an extension bundle fails validation or loading. The detail is a structured object: the ExtensionError dict (code 'reload-failed', message naming the bundle, location 'extension_id/bundle_name', hint) plus the full validation result dict. The server logs the bundle name and error code alongside, and the hint points at `lfx extension validate` for the actionable detail.

Source

Thrown at src/backend/base/langflow/api/v1/extensions.py:183

        # the body shape matches every other typed-error response in this
        # router.  The full ReloadResult body (including additional errors
        # and warnings) is preserved under the HTTPException ``detail``.
        primary = (
            result.errors[0]
            if result.errors
            else ExtensionError(
                code="reload-failed",
                message=f"Reload failed for bundle {bundle_name!r}.",
                location=f"{extension_id}/{bundle_name}",
                hint="Run `lfx extension validate` against the bundle source for details.",
            )
        )
        logger.warning(
            "extension reload failed: bundle=%s code=%s",
            bundle_name,
            primary.code,
        )
        raise HTTPException(
            status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
            detail={
                **primary.to_dict(),
                "result": result.to_dict(),
            },
        )

    return result.to_dict()


@router.get(
    "/events",
    response_model=ExtensionEventsResponse,
)
async def get_extension_events(
    current_user: CurrentActiveUser,
    since: Annotated[float, Query(description="UTC epoch timestamp; return events after this cursor")] = 0.0,
    keyspace: Annotated[

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Run `lfx extension validate` against the bundle source named in the message — it prints the exact failure
  2. Rebuild the bundle (lfx extension build) so artifacts match the manifest, then reload again
  3. Fix any import errors the validation reports (missing deps, syntax errors in the entry module)
  4. If the SDK version mismatches, rebuild the extension against the installed lfx version

Example fix

# before
curl -X POST .../extensions/{id}/reload  # 422 reload-failed

# after
lfx extension validate ./my-extension/bundles/main
curl -X POST .../extensions/{id}/reload
Defensive patterns

Strategy: validation

Validate before calling

import subprocess, sys

def bundle_valid(bundle_path: str) -> bool:
    return subprocess.run(
        ["lfx", "extension", "validate", bundle_path],
        capture_output=True,
    ).returncode == 0

Type guard

def is_reload_failure_detail(detail) -> bool:
    return (
        isinstance(detail, dict)
        and detail.get("code") == "reload-failed"
        and "result" in detail
    )

Try / catch

try:
    result = client.post(f"/extensions/{ext_id}/reload").raise_for_status().json()
except HTTPError as e:
    detail = e.response.json().get("detail", {})
    if detail.get("code") == "reload-failed":
        run_lfx_validate(detail.get("location"))
    raise

Prevention

When it happens

Trigger: POST reload for a bundle whose manifest is invalid, whose entry module fails to import, or whose built artifacts are missing/out of sync; reloading after hand-editing bundle files on disk; a bundle built with an incompatible lfx extension SDK version.

Common situations: Iterating on an lfx extension and reloading from the API/UI; deploying a bundle built on a different lfx version; editing bundle source without rebuilding so manifest checksums no longer match.

Related errors


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