Package dev.langchain4j.exception


package dev.langchain4j.exception
  • Class
    Description
    Signals that an asynchronous SPI method (an *Async method, or a reactive Publisher-returning method) is not implemented by a component, and is therefore the internal "this component is not genuinely asynchronous" marker carried by those methods' default implementations.
    Thrown when a request is rejected because the supplied credentials are missing, invalid, or insufficient (HTTP 401 / 403).
    Exception thrown when the LLM provider refuses to process a request due to content filtering or violation of usage policies.
    Represents an HTTP-level error returned by a model provider.
    Thrown when the model provider returns a server-side error (HTTP 5xx).
    Thrown when a DecisionModel returns a response that does not match the request, for example when an answer is missing, has the wrong type, or chooses an option that was not offered.
    Thrown when the model provider rejects a request because the request itself is malformed or violates the provider's constraints (HTTP 4xx, excluding 401, 403, 404, 408, and 429).
    Thrown when LangChain4j cannot read or write JSON.
    Thrown when JSON cannot be read: it is malformed, or it does not describe the expected type.
    Thrown when JSON that carries type information names a type the reader is not allowed to instantiate.
    Thrown when an object cannot be written as JSON.
    The root unchecked exception for all LangChain4j-specific errors.
    A ToolExecutionException whose message is written for the LLM, so it implements ToolErrorVisibleToLlm: error handlers that honor that interface send the message to the LLM instead of failing the AI Service invocation.
    Thrown when the requested model does not exist or is not accessible by the caller (HTTP 404).
    Indicates a permanent error for which retrying the same request will not help.
    Thrown when the model provider rejects a request because the caller has exceeded its allowed request or token quota within a time window (HTTP 429).
    Indicates a transient error that may succeed if the request is retried.
    Thrown when a request to the model provider does not complete within the configured time limit (HTTP 408 or a client-side read/connect timeout).
    Indicates that something is wrong with the tool arguments.
    Marks an exception whose content is meant to be seen by the LLM.
    A ready-made ToolErrorVisibleToLlm exception: throw it from a @Tool method when you want to tell the LLM what went wrong without declaring an exception class of your own.
    Indicates that something went wrong while executing the tool.
    Thrown when the model provider's host cannot be resolved (DNS failure or UnresolvedAddressException).
    Thrown when a requested feature is not supported by the current model provider or the specific model being used.