API ReferenceExceptions

Exceptions

Error types raised by the MinT API

Base Exceptions

TinkerError

Root exception for all MinT errors.

All MinT-specific exceptions inherit from this class.

APIError

Base class for API-related errors.

Properties:

  • body - Response body containing error details

Connection Errors

APIConnectionError

Raised when connection to the MinT server fails.

APITimeoutError

Raised when a request times out.

Inherits from: APIConnectionError

APIResponseValidationError

Raised when server response doesn’t match expected schema.

HTTP Status Errors

ExceptionStatus CodeDescription
BadRequestError400Invalid request format or parameters
AuthenticationError401Missing or invalid credentials
PermissionDeniedError403Insufficient permissions for operation
NotFoundError404Requested resource doesn’t exist
ConflictError409Resource state conflict
UnprocessableEntityError422Request is semantically invalid
RateLimitError429Too many requests (rate limit exceeded)
InternalServerError500+Server-side error

Async Errors

RequestFailedError

Raised when an async request fails to complete successfully. This can occur due to:

  • Transient server issues
  • Resource contention
  • Session timeout (see Limits and Quotas)

Properties:

  • request_id - Unique identifier for debugging (provide this when contacting support)

Retry Strategy:

import asyncio
from mint import RequestFailedError
 
async def sample_with_retry(sampling_client, prompt, params, max_retries=3):
    for attempt in range(max_retries):
        try:
            return await sampling_client.sample_async(prompt=prompt, sampling_params=params)
        except RequestFailedError as e:
            if attempt == max_retries - 1:
                raise
            wait_time = 2 ** attempt  # 1s, 2s, 4s
            print(f"Request failed (id={e.request_id}), retrying in {wait_time}s...")
            await asyncio.sleep(wait_time)

If errors persist after retries, create a fresh sampling client:

sampling_client = training_client.save_weights_and_get_sampling_client()

Usage Example

import mint
from mint.exceptions import (
    AuthenticationError,
    NotFoundError,
    RateLimitError
)
 
try:
    service_client = mint.ServiceClient()
    training_client = service_client.create_lora_training_client(
        base_model="Qwen/Qwen3-4B-Instruct-2507"
    )
except AuthenticationError:
    print("Invalid API key")
except NotFoundError:
    print("Model not found")
except RateLimitError:
    print("Rate limit exceeded, please wait")
except mint.TinkerError as e:
    print(f"MinT error: {e}")