BerriAI/litellm · error · ValueError
prompt_id is required for Langfuse prompt management
Error message
prompt_id is required for Langfuse prompt management
What it means
Guard in Langfuse _compile_prompt_helper: prompt_id is None, but Langfuse prompt management resolves prompts by prompt_id, so there is nothing to fetch from the Langfuse server.
Solutions
- Pass prompt_id in the request when using Langfuse prompt management.
Example fix
litellm.completion(model='gpt-4', prompt_id='my_langfuse_prompt', messages=msgs)
Defensive patterns
Strategy: validation
When it happens
Trigger: Calling Langfuse prompt management without supplying prompt_id.
Common situations: prompt_id omitted from the completion request.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/61b29b3df3df6e32.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/langfuse/langfuse_prompt_management.py:243
allow_env_credentials=dynamic_callback_params.get("langfuse_host") is None,
)
langfuse_prompt_client: Final = self._get_prompt_from_id(
langfuse_prompt_id=prompt_id,
langfuse_client=langfuse_client,
)
return langfuse_prompt_client is not None
def _compile_prompt_helper(
self,
prompt_id: str | None,
prompt_spec: PromptSpec | None,
prompt_variables: dict | None,
dynamic_callback_params: StandardCallbackDynamicParams,
prompt_label: str | None = None,
prompt_version: int | None = None,
) -> PromptManagementClient:
if prompt_id is None:
raise ValueError("prompt_id is required for Langfuse prompt management")
langfuse_client: Final = langfuse_client_init(
langfuse_public_key=dynamic_callback_params.get("langfuse_public_key"),
langfuse_secret=dynamic_callback_params.get("langfuse_secret"),
langfuse_secret_key=dynamic_callback_params.get("langfuse_secret_key"),
langfuse_host=dynamic_callback_params.get("langfuse_host"),
allow_env_credentials=dynamic_callback_params.get("langfuse_host") is None,
)
langfuse_prompt_client: Final = self._get_prompt_from_id(
langfuse_prompt_id=prompt_id,
langfuse_client=langfuse_client,
prompt_label=prompt_label,
prompt_version=prompt_version,
)
## SET PROMPT
compiled_prompt: Final = self._compile_prompt(
langfuse_prompt_client=langfuse_prompt_client,View on GitHub (pinned to 77b7c6c40c)