Skip to content

Conversation

@sahusiddharth
Copy link
Contributor

@sahusiddharth sahusiddharth commented Oct 21, 2025

Resolves: #6746

  • Catch HTTP 404 responses in the prompt retrieval method
  • Raise a descriptive ValueError with a clear message indicating the prompt wasn't found
  • Maintain all other HTTP error behavior unchanged

Minimal code to reproduce

from phoenix.client import Client

px_client = Client()

prompt_name = "non existant prompt"
px_client.prompts.get(prompt_identifier=prompt_name)

Note

Map 404s from prompt retrieval to a clear ValueError in both sync and async clients while preserving other HTTP errors.

  • Client prompts API:
    • Prompts.get and AsyncPrompts.get: catch httpx.HTTPStatusError 404 and raise ValueError("Prompt not found: ..."); other errors unchanged.
    • Docstrings updated to document ValueError in Raises.

Written by Cursor Bugbot for commit 51ed0ff. This will update automatically on new commits. Configure here.

@sahusiddharth sahusiddharth requested a review from a team as a code owner October 21, 2025 03:58
@github-project-automation github-project-automation bot moved this to 📘 Todo in phoenix Oct 21, 2025
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Oct 21, 2025
cursor[bot]

This comment was marked as outdated.

prompt_response.raise_for_status()
except HTTPStatusError as e:
if e.response.status_code == 404:
raise ValueError(f"Prompt not found: {prompt_identifier or prompt_version_id}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Error Message Mismatch in URL Lookup

The ValueError message for 404 responses in the get methods uses prompt_identifier or prompt_version_id. This expression's priority conflicts with the URL construction logic, which prioritizes prompt_version_id when both are provided. This results in misleading error messages, referencing the identifier that wasn't actually used for the lookup.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: 📘 Todo

Development

Successfully merging this pull request may close these issues.

[BUG]: Prompt Not Found - 404 Error

1 participant