BerriAI/litellm · error · Exception
Error getting prompt from Humanloop
Error message
Error getting prompt from Humanloop: {e.response.text} What it means
The Humanloop prompt-fetch request returned a non-2xx status; raise_for_status fired and the handler re-raises with the API's response body so the caller sees Humanloop's own error detail (auth, unknown prompt id, etc.).
Solutions
- Check the Humanloop API error text in the message for the specific cause.
- Verify HUMANLOOP_API_KEY is valid and the prompt exists in the Humanloop project.
Example fix
os.environ['HUMANLOOP_API_KEY'] = '...'; prompt = humanloop_prompt_manager.get_prompt('my_prompt') Defensive patterns
Strategy: try-catch
When it happens
Trigger: Fetching a prompt from Humanloop returns a non-2xx API response.
Common situations: Invalid API key, deleted prompt, or Humanloop service outage.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/1e1d53e6ced3b959.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/humanloop.py:79
return compiled_prompts
def _get_prompt_from_id_api(self, humanloop_prompt_id: str, humanloop_api_key: str) -> PromptManagementClient:
client: Final = _get_httpx_client()
base_url: Final = f"https://api.humanloop.com/v5/prompts/{humanloop_prompt_id}"
response: Final = client.get(
url=base_url,
headers={
"X-Api-Key": humanloop_api_key,
"Content-Type": "application/json",
},
)
try:
response.raise_for_status()
except httpx.HTTPStatusError as e:
raise Exception(f"Error getting prompt from Humanloop: {e.response.text}")
json_response: Final = response.json()
template_message: Final = json_response["template"]
if isinstance(template_message, dict):
template_messages = [template_message]
elif isinstance(template_message, list):
template_messages = template_message
else:
raise ValueError(f"Invalid template message type: {type(template_message)}")
template_model: Final = json_response["model"]
optional_params: Final = {}
for k, v in json_response.items():
if k in litellm.OPENAI_CHAT_COMPLETION_PARAMS:
optional_params[k] = v
return PromptManagementClient(
prompt_id=humanloop_prompt_id,
prompt_template=cast(list[AllMessageValues], template_messages),
model=template_model,View on GitHub (pinned to 77b7c6c40c)