Skip to content

ot_exceptions

korobka.opentrons.ot_exceptions ¤

Exceptions raised by this module.

Classes¤

ActionRejected(status_code, info) ¤

Bases: OTDriverError

The agent refused the submission, or the poll failed.

The status code carries the agent's own meaning and is worth branching on: 409 the slot is busy (retry), 503 the agent is still initialising (wait), 400 the action or payload was malformed (do not retry).

Stores HTTP status code and payload returned by the agent.

Source code in korobka/opentrons/ot_exceptions.py
78
79
80
81
82
def __init__(self, status_code: int, info: Any):
    """Stores HTTP status code and payload returned by the agent."""
    super().__init__(f"agent rejected action ({status_code}): {info}")
    self.status_code = status_code
    self.info = info
Methods:¤

BootstrapFailed ¤

Bases: OTDriverError

Session creation reached the backend but the agent never came up.

JobFailed(snapshot) ¤

Bases: OTDriverError

A job terminated in the failed status.

Stores the terminal snapshot returned by the agent.

Source code in korobka/opentrons/ot_exceptions.py
88
89
90
91
def __init__(self, snapshot: Mapping[str, Any]):
    """Stores the terminal snapshot returned by the agent."""
    super().__init__(f"job {snapshot.get('job_id')} failed: {snapshot.get('error')}")
    self.snapshot = dict(snapshot)
Methods:¤

NotAuthenticated ¤

Bases: OTDriverError

The API token was missing, malformed, revoked, or expired.

Distinct from :class:NotAuthorised: this means the system does not know who you are, so the fix is a new token, not different permissions.

NotAuthorised ¤

Bases: OTDriverError

The credential is valid but not permitted to do this.

Most often: driving a session that belongs to another account. A session token alone does not grant control — the account that opened the session must be the one presenting the API token.

OTDriverError ¤

Bases: RuntimeError

Base class for all client-side errors raised by this module.

ProxyError(status_code, detail) ¤

Bases: OTDriverError

The proxy returned an unexpected status code.

Stores HTTP status code and detail string from the response.

Source code in korobka/opentrons/ot_exceptions.py
20
21
22
23
24
def __init__(self, status_code: int, detail: str):
    """Stores HTTP status code and detail string from the response."""
    super().__init__(f"proxy returned {status_code}: {detail}")
    self.status_code = status_code
    self.detail = detail
Methods:¤

ProxyUnreachable ¤

Bases: OTDriverError

The proxy could not be contacted (connection refused, DNS, timeout).

RobotBusy ¤

Bases: OTDriverError

The requested robot is already occupied by another session.

SessionNotActive ¤

Bases: OTDriverError

The session has not been opened, has been closed, or has ended.

Also raised for a 410 on the action path, which means the session was still known but is no longer usable — aborted, failed, or orphaned by a backend restart. :meth:OTDriver.status will say which.

UnknownRobot ¤

Bases: OTDriverError

The backend does not recognise the robot, or the named config version.

Both are 404s from session creation. The detail string distinguishes them and is worth reading: an unresolvable config triple is far more often a typo in a version number than a missing robot.