Skip to content

Errors

Every exception sekai raises on purpose derives from SekaiError, so except sekai.SekaiError catches them all. They are exported from sekai and sekai.error, and they pickle cleanly, so they survive the trip from a worker process (ProcVecEnv, concurrent.futures.ProcessPoolExecutor, ...).

Argument validation (bad shapes, out-of-range parameters, wrong space types) raises the built-in ValueError / TypeError instead.

Exception Raised when
SekaiError base class
EnvNotFound an ID is not registered (with close-match suggestions)
EnvAlreadyRegistered an ID is registered twice
InvalidAction an environment rejects an action (built-in envs raise it; use it in yours)
ResetRequired step() (or a renderer) is used before reset()
VecEnvWorkerError a ProcVecEnv worker raised or died (carries rank, exc_type, remote_traceback)
VecEnvClosed a vector env is used after close()
LookAheadError a feature transform used information from the future (raised by sekai.finance.features.check_causal)
InvalidObservation, SpaceMismatch, AsyncCallPending not raised by sekai itself; available for your environments and tools

BackendMismatch is deprecated together with sekai.backend and will be removed in sekai 0.3. Nothing in sekai raises it; sekai.BackendMismatch and sekai.error.BackendMismatch still work but emit a DeprecationWarning, and it is no longer in sekai.__all__.

SekaiError

Bases: Exception

Base exception for all sekai errors.

Subclasses build their message from structured arguments, so the default exception pickling (which replays self.args, i.e. just the message) would fail. The constructor arguments are recorded instead, which keeps sekai errors picklable across processes (ProcVecEnv, ProcessPoolExecutor, ...).

EnvNotFound

EnvNotFound(id: str, suggestions: Sequence[str] = ())

Bases: SekaiError

id instance-attribute

id = id

suggestions instance-attribute

suggestions = tuple(suggestions)

EnvAlreadyRegistered

EnvAlreadyRegistered(id: str)

Bases: SekaiError

InvalidAction

InvalidAction(action: object, space: object)

Bases: SekaiError

InvalidObservation

InvalidObservation(obs: object, space: object)

Bases: SekaiError

ResetRequired

ResetRequired(message: str | None = None)

Bases: SekaiError

AsyncCallPending

AsyncCallPending()

Bases: SekaiError

SpaceMismatch

SpaceMismatch(msg: str)

Bases: SekaiError

VecEnvWorkerError

VecEnvWorkerError(rank: int, exc_type: str, message: str, remote_traceback: str)

Bases: SekaiError

An exception raised inside a ProcVecEnv worker process.

rank instance-attribute

rank = rank

exc_type instance-attribute

exc_type = exc_type

remote_traceback instance-attribute

remote_traceback = remote_traceback

VecEnvClosed

VecEnvClosed()

Bases: SekaiError

LookAheadError

LookAheadError(msg: str)

Bases: SekaiError

A feature or data transform used information from the future (look-ahead bias).