Class CorrectableRuntimeLLMException

All Implemented Interfaces:
LLMReadable, LLMReadableException, Serializable

public non-sealed class CorrectableRuntimeLLMException extends LLMReadableRuntimeException
Runtime (unchecked) exception indicating the LLM's input was wrong and it may fix its parameters and retry.

This is the unchecked counterpart of CorrectableLLMException. Use when checked exceptions are impractical but the error is still correctable by the LLM.

Example usage:

// In a stream operation where checked exceptions can't be thrown
items.stream().map(item -> {
    try {
        return Integer.parseInt(item);
    } catch (NumberFormatException e) {
        throw new CorrectableRuntimeLLMException(
            "Parameter 'items' contains non-integer value: " + item, e);
    }
});
Since:
0.1 (2026-03-13)
Author:
Andrey Santrosyan
See Also:
  • Constructor Details

    • CorrectableRuntimeLLMException

      public CorrectableRuntimeLLMException(String llmMessage)
      Constructs a correctable runtime exception with the specified LLM message.
      Parameters:
      llmMessage - clean, actionable error message for LLM understanding
    • CorrectableRuntimeLLMException

      public CorrectableRuntimeLLMException(String llmMessage, Throwable cause)
      Constructs a correctable runtime exception with the specified LLM message and cause.
      Parameters:
      llmMessage - clean, actionable error message for LLM understanding
      cause - the cause (preserved for developer debugging)
  • Method Details

    • isCorrectable

      public final boolean isCorrectable()
      Description copied from interface: LLMReadableException
      Indicates whether the LLM may retry the same tool with different input.

      true (correctable): The LLM's input was wrong. It may fix its parameters and call the same tool again.

      false (uncorrectable): The tool itself cannot work right now, regardless of input. The LLM should try a different approach.

      Returns:
      true if correctable, false if uncorrectable
    • explainToLLM

      public String explainToLLM()
      Description copied from interface: LLMReadableException
      Explains the error to the LLM for inclusion in the conversation context.

      The default implementation returns just the LLM message. Subclasses typically append a hint indicating whether the error is correctable or not, so the LLM knows whether to retry or try a different approach.

      Returns:
      full error explanation for the LLM