BerriAI/litellm · error · LangFlowError
flow_id is required; use model langflow/{flow_id}
Error message
flow_id is required; use model langflow/{flow_id} What it means
LiteLLM requires the LangFlow flow ID in the model string. After disallowing parameter-based flow_id, _get_flow_id splits the model on '/' and strips whitespace; if the result is empty (model was 'langflow/', 'langflow/ ', or an empty string), it raises LangFlowError 400 telling you to use the 'langflow/{flow_id}' format.
Source
Thrown at litellm/llms/langflow/chat/transformation.py:82
) -> dict:
return optional_params
def _get_flow_id(self, model: str, optional_params: dict) -> str:
"""
Extract flow_id from the authorized model name only.
Model format: "langflow/{flow_id}". Request kwargs must not override
flow_id (would allow calling another flow with the same API key).
"""
if optional_params.get("flow_id") is not None:
raise LangFlowError(
status_code=400,
message=("flow_id cannot be set via request parameters; use model langflow/{flow_id}"),
)
flow_id: Final = (model.split("/", 1)[1] if "/" in model else model).strip()
if not flow_id:
raise LangFlowError(
status_code=400,
message="flow_id is required; use model langflow/{flow_id}",
)
return flow_id
def get_complete_url(
self,
api_base: str | None,
api_key: str | None,
model: str,
optional_params: dict,
litellm_params: dict,
stream: bool | None = None,
) -> str:
if api_base is None:
raise ValueError(
"api_base is required for LangFlow. Set it via LANGFLOW_API_BASE env var or api_base parameter."
)View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set the model to the full form including the flow ID: "langflow/<your-flow-id>"
- If the model comes from a template/config, make sure the interpolated variable is non-empty and stripped
- Fetch valid flow IDs from the LangFlow UI URL or /api/v1/flows and use one
Example fix
# before litellm.completion(model="langflow/", messages=msgs) # after litellm.completion(model="langflow/8b0e04bc-4f28-4ed9-9c1c-1d6c2ece7d33", messages=msgs)
Defensive patterns
Strategy: validation
Validate before calling
def resolve_langflow_model(flow_id: str | None) -> str:
if not flow_id or not flow_id.strip():
raise ValueError("flow_id is required and must be a non-empty string")
return f"langflow/{flow_id.strip()}" Type guard
def is_nonempty_flow_id(v) -> bool:
return isinstance(v, str) and bool(v.strip()) Try / catch
try:
litellm.completion(model=resolve_langflow_model(cfg["flow_id"]), messages=msgs)
except LangFlowError as e:
if e.status_code == 400:
# surface a config error: the model string did not carry a flow id
raise RuntimeError("LangFlow model misconfigured: missing flow id") from e Prevention
- Validate model entries at config-load time: every langflow/* model must have a non-empty flow segment
- Fail fast on empty template variables before interpolating them into model names
- Integration-test the model string against _get_flow_id semantics (split on first '/', strip)
When it happens
Trigger: model="langflow/" or "langflow/ " (empty segment after the slash); model=""; a model alias/config whose name resolves to a bare provider prefix without a flow ID; whitespace-only flow ID from a misformatted config string.
Common situations: Router/model_list entry with model_name="langflow/" awaiting a value; templating bug that interpolates an empty variable into the model string (f"langflow/{flow_id}" with flow_id=None or ''); copying a config example and forgetting to substitute the flow ID.
Related errors
- flow_id cannot be set via request parameters; use model lang
- tweaks cannot be set via request parameters; they would over
- litellm_params is required for LangFlowA2AConfig (must conta
- Event hook {hook} is not in the supported event hooks {suppo
- Event hook {event_hook} is not in the supported event hooks
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/30e280fe9c674a20.
Report an issue: GitHub.