BerriAI/litellm · error · ValueError
prompt_id is required for BitBucket prompt manager
Error message
prompt_id is required for BitBucket prompt manager
What it means
ValueError raised by BitBucketPromptManager._compile_prompt_helper when prompt_id is None. The BitBucket prompt manager has no way to infer which prompt to use — unlike database-backed prompt managers it cannot look up by spec/label/version alone — so a request that reaches compilation without a concrete prompt_id fails fast here.
Solutions
- Pass prompt_id explicitly in the completion request params (e.g. {"prompt_id": "my-prompt"})
- If you meant to use the LiteLLM prompt registry, use that handler instead — BitBucket mode requires the literal id
- Guard call sites: assert prompt_id is not None before invoking the helper
- Check that routing/prompt-spec config actually resolves to a prompt_id for this request
Example fix
// before
response = litellm.completion(model="gpt-4o", messages=[{"role": "user", "content": "hi"}], prompt_variables={"t": t})
// after
response = litellm.completion(
model="gpt-4o",
messages=[{"role": "user", "content": "hi"}],
prompt_id="my-prompt", # required for BitBucket prompt manager
prompt_variables={"t": t},
) Defensive patterns
Strategy: validation
Validate before calling
if prompt_id is None:
raise ValueError("BitBucket prompt manager requires an explicit prompt_id in request params")
result = manager._compile_prompt_helper(prompt_id, prompt_variables, dynamic_callback_params) Type guard
def has_prompt_id(params: dict) -> bool:
return bool(params.get("prompt_id")) Try / catch
try:
result = await manager.async_compile_prompt_helper(prompt_id, variables, params)
except ValueError as e:
if "prompt_id is required" in str(e):
... # reject the request early with a 4xx explaining the missing param
raise Prevention
- Always send prompt_id in completion params for routes bound to the BitBucket handler
- Add request-level validation rejecting prompt-bound routes without prompt_id
- Don't assume label/version lookups work — the BitBucket manager only accepts literal ids
When it happens
Trigger: Configuring the BitBucket prompt management handler but issuing a completion call without a 'prompt_id' parameter; passing prompt_label/prompt_version without prompt_id and no prompt_spec that resolves to an id; programmatic callers invoking the helper with None.
Common situations: Migrating from LiteLLM's prompt registry (where label/version lookups work) to BitBucket-backed prompts and assuming the same lookup semantics; config yaml referencing prompt_id only in some routes; SDK calls that drop unset optional params to None.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- bitbucket_config is required for BitBucket prompt…
- BitBucket configuration not found. Please set…
- Cannot set prompt_directory when working with…
- Error compiling prompt
- Failed to load prompt
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/95110e2e9b3efe4e.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/bitbucket/bitbucket_prompt_manager.py:443
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:
"""
Compile a BitBucket prompt template into a PromptManagementClient structure.
This method:
1. Loads the prompt template from BitBucket
2. Renders it with the provided variables
3. Converts the rendered text into chat messages
4. Extracts model and optional parameters from metadata
"""
if prompt_id is None:
raise ValueError("prompt_id is required for BitBucket prompt manager")
try:
# Load the prompt from BitBucket if not already loaded
if prompt_id not in self.prompt_manager.prompts:
self.prompt_manager._load_prompt_from_bitbucket(prompt_id)
# Get the rendered prompt and metadata
rendered_prompt, prompt_metadata = self.get_prompt_template(prompt_id, prompt_variables)
# Convert rendered content to chat messages
messages: Final = self._parse_prompt_to_messages(rendered_prompt)
# Extract model from metadata (if specified)
template_model: Final = prompt_metadata.get("model")
# Extract optional parameters from metadata
optional_params: Final = {}
for param in [View on GitHub (pinned to 77b7c6c40c)