{"record":{"id":"ef0090874599bc37","repo":"langflow-ai/langflow","slug":"primary-to-dict-result-result-to-dict","errorCode":null,"errorMessage":"{**primary.to_dict(), \"result\": result.to_dict()}","messagePattern":"\\{\\*\\*primary\\.to_dict\\(\\), \"result\": result\\.to_dict\\(\\)\\}","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"error","filePath":"src/backend/base/langflow/api/v1/extensions.py","lineNumber":183,"sourceCode":"        # the body shape matches every other typed-error response in this\n        # router.  The full ReloadResult body (including additional errors\n        # and warnings) is preserved under the HTTPException ``detail``.\n        primary = (\n            result.errors[0]\n            if result.errors\n            else ExtensionError(\n                code=\"reload-failed\",\n                message=f\"Reload failed for bundle {bundle_name!r}.\",\n                location=f\"{extension_id}/{bundle_name}\",\n                hint=\"Run `lfx extension validate` against the bundle source for details.\",\n            )\n        )\n        logger.warning(\n            \"extension reload failed: bundle=%s code=%s\",\n            bundle_name,\n            primary.code,\n        )\n        raise HTTPException(\n            status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,\n            detail={\n                **primary.to_dict(),\n                \"result\": result.to_dict(),\n            },\n        )\n\n    return result.to_dict()\n\n\n@router.get(\n    \"/events\",\n    response_model=ExtensionEventsResponse,\n)\nasync def get_extension_events(\n    current_user: CurrentActiveUser,\n    since: Annotated[float, Query(description=\"UTC epoch timestamp; return events after this cursor\")] = 0.0,\n    keyspace: Annotated[","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/extensions.py#L165-L201","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `lfx extension validate` against the bundle source named in the message — it prints the exact failure","Rebuild the bundle (lfx extension build) so artifacts match the manifest, then reload again","Fix any import errors the validation reports (missing deps, syntax errors in the entry module)","If the SDK version mismatches, rebuild the extension against the installed lfx version"],"exampleFix":"# before\ncurl -X POST .../extensions/{id}/reload  # 422 reload-failed\n\n# after\nlfx extension validate ./my-extension/bundles/main\ncurl -X POST .../extensions/{id}/reload","handlingStrategy":"validation","validationCode":"import subprocess, sys\n\ndef bundle_valid(bundle_path: str) -> bool:\n    return subprocess.run(\n        [\"lfx\", \"extension\", \"validate\", bundle_path],\n        capture_output=True,\n    ).returncode == 0","typeGuard":"def is_reload_failure_detail(detail) -> bool:\n    return (\n        isinstance(detail, dict)\n        and detail.get(\"code\") == \"reload-failed\"\n        and \"result\" in detail\n    )","tryCatchPattern":"try:\n    result = client.post(f\"/extensions/{ext_id}/reload\").raise_for_status().json()\nexcept HTTPError as e:\n    detail = e.response.json().get(\"detail\", {})\n    if detail.get(\"code\") == \"reload-failed\":\n        run_lfx_validate(detail.get(\"location\"))\n    raise","preventionTips":["Run `lfx extension validate` in CI for every bundle before deploy","Rebuild bundles with the same lfx version as the target server","Automate reload retries only after validation passes locally"],"tags":["extensions","lfx","http-422","validation"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}