Class Http403Exception

All Implemented Interfaces:
HttpErrorResponse, LLMReadable, LLMReadableException, Serializable

public class Http403Exception extends UnauthorizedException implements HttpErrorResponse
HTTP 403 Forbidden from an upstream API.

Credentials are valid but the server refuses access. Specialization of UnauthorizedException - uncorrectable by the LLM. Distinct from Http401Exception because 403 often signals stronger conditions: permission revoked, IP block, anti-abuse / robot detection, jailbreak trigger, or geo-restriction. Catch this specifically when you need to react to those conditions (e.g. flag suspected jailbreak attempts).

The server's own response is carried in HttpErrorDetail and read through HttpErrorResponse, so callers can act on the real upstream error, not a hardcoded message.

Since:
0.1 (2026-04-14)
Author:
Andrey Santrosyan
See Also:
  • Constructor Details

  • Method Details

    • http

      public HttpErrorDetail http()
      Description copied from interface: HttpErrorResponse
      The server's response: status, service, endpoint, raw body. The one record the carrier built at construction, returned identically on every call.
      Specified by:
      http in interface HttpErrorResponse
    • getLLMMessage

      public String getLLMMessage()
      Description copied from class: LLMReadableCheckedException
      Returns a clean, actionable error message suitable for LLM understanding.

      This message should:

      • Explain what went wrong in plain language
      • Be specific about which parameter or input caused the problem
      • Suggest how to fix the issue when possible
      • Avoid stack traces, exception types, or code references

      Good examples:

      • "Maximum result limit is 100. Please reduce maxResults parameter to 100 or less."
      • "Parameter 'dateFrom' has invalid format '2024-13-01'. Use ISO 8601 format: YYYY-MM-DD."
      • "Permission denied to access system clock. This tool requires elevated privileges."

      Bad examples:

      • "NullPointerException at line 247"
      • "Error code -1"
      • "Invalid input" (not specific enough)
      Specified by:
      getLLMMessage in interface LLMReadable
      Overrides:
      getLLMMessage in class UnauthorizedException
      Returns:
      clean, actionable error message for LLM