Skip to content

Errors

Class Base Raised when
SegmentExistsError FileExistsError creating a box under a name that is already taken
SegmentNotFoundError FileNotFoundError attaching to, or unlinking on Linux, a name with no segment; attaching to shared memory that does not become a box within 1 s
SchemaMismatchError TypeError attaching, or unpickling a box, with a class whose identity or fields differ from the creator's; a segment of another layout major version; a segment with a field of a kind this version cannot read; unpickling after the box was created again
BoxClosedError ValueError using a box after close()
LockTimeoutError TimeoutError a read or write waits for a write in progress for longer than lock_timeout
BrokenReferenceError LookupError reading a reference field, or snapshot(follow=True), when the box it refers to was removed or created again since it was assigned
UnknownBoxClassError TypeError reading a reference field, or snapshot(follow=True), when no class this process has defined has the stored box's schema hash

BoxClosedError

Bases: ValueError

The segment handle has been closed.

Raised by using a box after close.

BrokenReferenceError

Bases: LookupError

The box a reference field refers to no longer exists, or was created again.

Raised by reading a reference field, or by snapshot(follow=True), when the box was removed, or removed and created again, since it was assigned. The message names the field, the box and which of the two happened.

LockTimeoutError

Bases: TimeoutError

The write lock stayed taken for longer than the lock timeout.

Raised by a read or write that waits for a write in progress for longer than the class's lock_timeout. The message names the process that holds the lock.

SchemaMismatchError

Bases: TypeError

The segment was created by a different class or layout.

Raised by attaching, or unpickling a box, with a class whose identity or fields differ from the creator's; by a segment of another layout major version or with a field of a kind this version cannot read, which the message names; and by unpickling after the box was created again.

SegmentExistsError

Bases: FileExistsError

A segment with that name already exists.

Raised by creating a box under a name that is taken. The message says which case it is:

  • the box's creator is still running, with its pid;
  • the box is still being created: its creator is running and has not returned from __post_init__ yet. The message gives its pid and says to wait for it or use another name;
  • the creator runs in another pid namespace, such as another container;
  • the creator is no longer running. On Linux the box is then probably left over from a crash, and unlink(name) on its class removes it. On Windows a process, possibly this one, still has the box open, and the name is freed when every handle to it is closed;
  • the name holds no published box. On Linux it may be left over from a crash during creation, and unlink(name) on its class removes it. On Windows a process, possibly this one, still has something open under that name, and the name is freed when every handle to it is closed.

When none of these can be told, the message only says the name is taken. Nothing is removed automatically.

SegmentNotFoundError

Bases: FileNotFoundError

No segment has that name.

Raised by attaching to, or unlinking on Linux, a name with no segment, and by attaching to shared memory that does not become a box within 1 s.

UnknownBoxClassError

Bases: TypeError

No class defined in this process has the schema hash of the box a reference field refers to.

Raised by reading a reference field, or by snapshot(follow=True). The message names the field, the box and the hash, and says to import the module that defines the class.