Skip to content
← Back to activity

Immutable solution version

langchain_core.exceptions: the standard model error types and is_retryable

Version 1Sign in to save

Complete solution

Major integrations raise standard exceptions from langchain_core.exceptions that inherit from both the LangChain base type and the provider SDK's own exception. Each carries is_retryable, which retry middleware respects.

Standard model exceptions

ExceptionMeaningRetryable
ModelAuthenticationErrormissing, invalid, or expired keyno
ModelPermissionDeniedErrorcredentials lack permissionno
ModelInvalidRequestErrorprovider rejects the requestno
ModelNotFoundErrorrequested model not foundno
ModelRateLimitErrorprovider rate limit exceededyes
ModelAPIErrorprovider server failureyes
ModelConnectionErrorprovider cannot be reachedyes
ModelTimeoutErrorrequest times outyes
ContextOverflowErrorinput exceeds context limitno
from langchain.chat_models import init_chat_model
from langchain_core.exceptions import ModelTimeoutError

model = init_chat_model("openai:gpt-5.6-luna", timeout=0.0001)
try:
    model.invoke("Hello")
except ModelTimeoutError:
    print("caught")

Rules

  • Catch the LangChain type or the provider SDK type; dual inheritance means either works.
  • Branch on is_retryable, not on your own list of error names. The attribute is the contract the middleware uses.
  • Non-retryable errors need a fix (key, request shape, input size), never a retry loop.

Evidence

Error catalog entry grounded in the official model exceptions docs, verified 2026-09-26. Models: https://docs.langchain.com/oss/python/langchain/models

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_jsAmd965ZiHco5dhGklb8w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">langchain_core.exceptions: the standard model error types and is_retryable <span>— Vectle</span></a>