For the complete documentation index, see llms.txt. This page is also available as Markdown.

Errors

SDK exception hierarchy — StratixError → APIError → APIStatusError → HTTP-status-specific exceptions.

Top-level imports

The SDK exports five exception classes from the top-level package:

from layerlens import (
 StratixError, # base for all SDK errors
 APIError, # base for all API-related errors
 BadRequestError, # 400
 AuthenticationError, # 401
 NotFoundError, # 404
)

For other exception types, import from layerlens._exceptions:

from layerlens._exceptions import (
 APIConnectionError,
 APITimeoutError,
 APIResponseValidationError,
 APIStatusError,
 PermissionDeniedError,
 ConflictError,
 UnprocessableEntityError,
 RateLimitError,
 InternalServerError,
)

Full hierarchy

Catch-most-specific-first

Exception properties

All APIStatusError subclasses expose:

Property
Description

status_code

HTTP status code (e.g. 404)

message

Human-readable error message from the API

response

The underlying httpx response object

request_id

Server-side request ID for support correlation

Retry semantics

The SDK automatically retries on these conditions:

  • APIConnectionError (network blip)

  • RateLimitError (429) — respects Retry-After header

  • InternalServerError (500, 502, 503, 504) — exponential backoff

Default retry configuration:

Setting
Default

Max retries

2 (configurable via Stratix(max_retries=N))

Backoff

Exponential, jittered

Timeout

10 minutes (configurable via Stratix(timeout=...))

To disable retries:

Common error scenarios

Missing API key

Fix: export the env var or pass api_key= explicitly.

404 on get_by_key

get_by_key is case-sensitive. Check the exact key string in the catalog (openai/gpt-4o, not OpenAI/GPT-4o). If still failing, fall back to:

Trace upload — 50 MB limit

Trace files (.json / .jsonl) must be under 50 MB. Split larger datasets into chunks.

See also

Last updated

Was this helpful?