Skip to content

Exceptions

All custom exceptions inherit from LSMError.

Exception hierarchy for kiwidb.

All custom exceptions inherit from LSMError. Import only from this module — never define exceptions in implementation files.

LSMError

Bases: Exception

Base class for all kiwidb exceptions.

WALCorruptError

Bases: LSMError

WAL replay encountered a malformed entry.

WALTruncateError

Bases: LSMError

WAL truncation failed — file system error.

EngineClosed

Bases: LSMError

put() / get() / delete() called after LSMEngine.close().

MemTableFullError

Bases: LSMError

ActiveMemTable exceeded MAX_MEMTABLE_SIZE.

SnapshotEmptyError

Bases: LSMError

freeze() called on an empty ActiveMemTable.

SkipListInsertError

Bases: LSMError

SkipList.put() failed after exhausting retries.

SkipListKeyError

Bases: LSMError

Operation on a key that violates SkipList invariants (e.g., empty key).

FreezeBackpressureTimeout

Bases: LSMError

maybe_freeze() waited too long for queue space — flush worker may be stuck.

ImmutableTableAccessError

Bases: LSMError

Mutation attempted on an ImmutableMemTable.

MemTableRestoreError

Bases: LSMError

WAL replay into MemTable failed during recovery.

CorruptRecordError

Bases: LSMError

Data-block record failed CRC or structural validation.

SSTableWriteError

Bases: LSMError

SSTable write failed (disk I/O, ordering violation, etc.).

SSTableReadError

Bases: LSMError

SSTable read or open failed.

FlushError

Bases: LSMError

Flush pipeline encountered an unrecoverable error.

CompactionError

Bases: LSMError

Compaction job failed — subprocess error or I/O failure.