{"record":{"id":"30e280fe9c674a20","repo":"BerriAI/litellm","slug":"flow-id-is-required-use-model-langflow-flow-id","errorCode":null,"errorMessage":"flow_id is required; use model langflow/{flow_id}","messagePattern":"flow_id is required; use model langflow/(.+?)","errorType":"validation","errorClass":"LangFlowError","httpStatus":400,"severity":"error","filePath":"litellm/llms/langflow/chat/transformation.py","lineNumber":82,"sourceCode":"    ) -> dict:\n        return optional_params\n\n    def _get_flow_id(self, model: str, optional_params: dict) -> str:\n        \"\"\"\n        Extract flow_id from the authorized model name only.\n\n        Model format: \"langflow/{flow_id}\". Request kwargs must not override\n        flow_id (would allow calling another flow with the same API key).\n        \"\"\"\n        if optional_params.get(\"flow_id\") is not None:\n            raise LangFlowError(\n                status_code=400,\n                message=(\"flow_id cannot be set via request parameters; use model langflow/{flow_id}\"),\n            )\n\n        flow_id: Final = (model.split(\"/\", 1)[1] if \"/\" in model else model).strip()\n        if not flow_id:\n            raise LangFlowError(\n                status_code=400,\n                message=\"flow_id is required; use model langflow/{flow_id}\",\n            )\n        return flow_id\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        api_key: str | None,\n        model: str,\n        optional_params: dict,\n        litellm_params: dict,\n        stream: bool | None = None,\n    ) -> str:\n        if api_base is None:\n            raise ValueError(\n                \"api_base is required for LangFlow. Set it via LANGFLOW_API_BASE env var or api_base parameter.\"\n            )","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/langflow/chat/transformation.py#L64-L100","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nlitellm.completion(model=\"langflow/\", messages=msgs)\n\n# after\nlitellm.completion(model=\"langflow/8b0e04bc-4f28-4ed9-9c1c-1d6c2ece7d33\", messages=msgs)","handlingStrategy":"validation","validationCode":"def resolve_langflow_model(flow_id: str | None) -> str:\n    if not flow_id or not flow_id.strip():\n        raise ValueError(\"flow_id is required and must be a non-empty string\")\n    return f\"langflow/{flow_id.strip()}\"","typeGuard":"def is_nonempty_flow_id(v) -> bool:\n    return isinstance(v, str) and bool(v.strip())","tryCatchPattern":"try:\n    litellm.completion(model=resolve_langflow_model(cfg[\"flow_id\"]), messages=msgs)\nexcept LangFlowError as e:\n    if e.status_code == 400:\n        # surface a config error: the model string did not carry a flow id\n        raise RuntimeError(\"LangFlow model misconfigured: missing flow id\") from e","preventionTips":["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)"],"tags":["langflow","validation","config"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}