langflow-ai/langflow · error · HTTPException
This flow cannot be executed.
Error message
This flow cannot be executed.
What it means
Raised as HTTP 400 with the static detail 'This flow cannot be executed.' when the public (unauthenticated) build endpoint's pre-flight validation fails with CustomComponentValidationError. The real reason is logged ('Public flow validation failed: ...') but not returned, so anonymous callers learn nothing about the private flow's internals — only that the share is not executable.
Source
Thrown at src/backend/base/langflow/api/v1/chat.py:937
)
if sanitized_public_data is not None
else None
),
files=files,
stop_component_id=stop_component_id,
start_component_id=start_component_id,
log_builds=log_builds or False,
current_user=owner_user,
queue_service=queue_service,
flow_name=flow_name or f"{authenticated_user_id or client_id}_{flow_id}",
)
# Gate the public events/cancel endpoints to jobs that were actually
# started through this public build path, preventing unauthenticated
# callers from reading or cancelling private-flow builds by job_id.
await queue_service.register_public_job(job_id)
except CustomComponentValidationError as exc:
await logger.awarning(f"Public flow validation failed: {exc}")
raise HTTPException(status_code=400, detail="This flow cannot be executed.") from exc
except JobQueueBackendUnavailableError as exc:
# The public marker could not be persisted to the shared (Redis) backend.
# Returning the job_id anyway would hand back an un-shareable id: on a
# multi-worker deployment every other worker's public events/cancel
# endpoints would 404 it. Cancel the just-started build (best-effort) and
# surface a clean 503 instead of a 500 / an unusable job_id.
try:
await queue_service.cancel_job(job_id)
except Exception as cancel_exc: # noqa: BLE001
await logger.awarning(
f"Failed to cancel public job {job_id} after marker persistence failed: {cancel_exc!r}"
)
raise HTTPException(status_code=503, detail=str(exc)) from exc
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc)) from exc
except Exception as exc:
await logger.aexception("Error building public flow")
if isinstance(exc, HTTPException):View on GitHub (pinned to 976ec789d2)
Solutions
- As the flow owner, run the flow in the Langflow UI — the editor will show the exact component validation error that the public endpoint hides.
- Fix or remove the failing custom component, re-save the flow, then re-share.
- Verify the deployment has every dependency the custom component imports.
- Re-create the public link if the flow was substantially edited after sharing.
Defensive patterns
Strategy: validation
Validate before calling
# Owner-side preflight: run the flow once before sharing publicly
res = await client.post(f"/api/v1/chat/build/{flow_id}")
res.raise_for_status() # surfaces the real validation error the public endpoint hides Try / catch
try:
res = await client.post(public_build_url)
except httpx.HTTPStatusError as e:
if e.response.status_code == 400 and e.response.json()["detail"] == "This flow cannot be executed.":
notify_owner("Shared flow fails validation; fix it in the editor and re-share")
return
raise Prevention
- Always test-run a flow in the UI before creating a public share link.
- Re-test public links after editing the flow or upgrading Langflow.
- Understand the 400 detail is static by design — diagnostics live in server logs and the owner's editor.
When it happens
Trigger: POST to the public build endpoint (public preview/share URL) for a flow containing a custom component whose code fails validation, or whose graph does not survive validate_flow_for_current_settings.
Common situations: Sharing a flow whose custom component was written against a different Langflow version; component code depending on packages not installed on the serving deployment; flow edited and broken after the public link was created.
Related errors
- Invalid filename
- No client_id cookie found
- Job not found
- Cannot cancel job with status '{job_status}'
- Failed to install MCP
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/c5fd531bf0a05659.
Report an issue: GitHub.