Skip to content

Custom exceptions raised by SWE-agent

exceptions

FormatError

Raised when the model response cannot properly be parsed into thought and actions.

FunctionCallingFormatError

FunctionCallingFormatError(message: str, error_code: Literal['missing', 'multiple', 'incorrect_args', 'invalid_json', 'invalid_command', 'missing_arg', 'unexpected_arg'], **extra_info: Any)

Format error exception used by the function calling parser.

Source code in sweagent/exceptions.py
14
15
16
17
18
19
20
21
22
23
24
def __init__(
    self,
    message: str,
    error_code: Literal[
        "missing", "multiple", "incorrect_args", "invalid_json", "invalid_command", "missing_arg", "unexpected_arg"
    ],
    **extra_info: Any,
):
    super().__init__(message + f" [error_code={error_code}]")
    self.message = message
    self.extra_info = {"error_code": error_code, **extra_info}

message instance-attribute

message = message

extra_info instance-attribute

extra_info = {'error_code': error_code, None: extra_info}

ContextWindowExceededError

Raised when the context window of a LM is exceeded

CostLimitExceededError

Raised when we exceed a cost limit

InstanceCostLimitExceededError

Raised when we exceed the cost limit set for one task instance

TotalCostLimitExceededError

Raised when we exceed the total cost limit

InstanceCallLimitExceededError

Raised when we exceed the per instance call limit

ContentPolicyViolationError

Raised when the model response violates a content policy

ModelConfigurationError

Raised when the model configuration is invalid/no further retries should be made.