Skip to content

Conversation

@ORC-EMG
Copy link

@ORC-EMG ORC-EMG commented Dec 2, 2025

Adding support for OCI exception mapping logic in Litellm

Relevant issues

In testing LiteLLM with OCI, error mapping is not occurring as expected. Errors are returned wrapped in a LiteLLM 500 error by the LiteLLM exception_mapping_utils. py file. This includes when errors are actually 401, 404, 429, and other errors as returned by OCI they are wrapped in a 500 LiteLLM error. This can lead to misleading developers and users of the actual issue occurring.

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix
✅ Test

Changes

Added exception mapping functions and logic specifically for OCI in the oci_exception_mapping_utils.py file in the same style as other providers. Added the test files in the tests directory per the contributing hard requirement checklist..

@vercel
Copy link

vercel bot commented Dec 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Error Error Dec 3, 2025 1:19am

…ated to HTTP 409 code for OCI error mapping update, added ConflictError to list of exception types
…t from exceptions.py as part of test case for added logic in PR
@ORC-EMG
Copy link
Author

ORC-EMG commented Dec 3, 2025

Screenshot 2025-12-02 at 8 19 43 PM Screenshot 2025-12-02 at 8 18 38 PM

@ORC-EMG ORC-EMG marked this pull request as ready for review December 3, 2025 01:24
_message += f", LiteLLM Max Retries: {self.max_retries}"
return _message

class ConflictError(openai.ConflictError): # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems like a new exception - what version of openai is required for this?

Copy link
Author

Choose a reason for hiding this comment

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

Version 2.8.1
python -c "import openai; print(openai.version); print(hasattr(openai, 'ConflictError'))"
2.8.1
True

It is also documented here https://platform.openai.com/docs/guides/error-codes

Copy link
Contributor

Choose a reason for hiding this comment

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

@ORC-EMG you should bump the litellm openai dep as well in that case, as we support 2.8.0 + -

openai = ">=2.8.0"

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants