Skip to main content
This reference is for developers who handle storage errors in code and for anyone fixing a store from an Atomic error message. It lists each typed error that storage operations raise, with its code, its fields, what it means, and what to do. For choosing and configuring a store, see Storage. In code, inspect the error class, code, and structured fields rather than matching message text. Unless noted otherwise, classes are exported from @bastani/atomic/storage and re-exported from @bastani/atomic.

Common errors

The following table lists the errors any store can raise:

Session errors

The following table lists the errors a session store raises for tool output files and released session history: Other session errors: SessionNotFoundError (sessionId), SessionExistsError (sessionId), SessionIdMismatchError (requested, found), SessionConflictError (sessionId, expectedSeq, actualSeq), SessionFormatVersionError (path, found, supported), SessionInvalidTextError (field, reason), SessionInvalidTimestampError (field, reason, value), and JsonlStoragePoisonedError (location, cause, rollbackCause). After SessionConflictError, another process wrote first—reopen the session before writing again.
When a live PostgreSQL session is waiting to save: Leave it running if you see Waiting for PostgreSQL to save this session. Atomic keeps retrying pending saves in order, even in print and JSON modes. See What to do while PostgreSQL is unavailable for notices, wait settings, and a PgBouncer example.When a save fails instead of waiting: Atomic reports could not persist the <role> message along with the reason and stops the current run. Print and JSON modes exit 1. Interactive mode stays open so you can fix the reported problem and try again.

Database handle errors

Direct SqliteDatabase handles that SDK applications open raise these errors. The first four apply to local SQLite handles only (see SDK and local SQLite API).

Handle storage errors in code

The storage modules export these helpers for checking and passing errors:
  • Cross-process type guards: isStorageConfigError, isStorageWriteLockTimeoutError, isStorageUnsupportedOperationError, isStorageWriterQueueDegradedError, isStorageWriterQueueUnusableError, isStorageTransientError, isSessionBlobError, isSessionSpillError, and isStorageError. Code lists: STORAGE_TRANSIENT_ERROR_CODES, SESSION_BLOB_ERROR_CODES, and SESSION_SPILL_ERROR_CODES.
  • Cause-chain inspection: findStorageWriteLockTimeoutError(error) and isRetryableStorageError(error) inspect up to 8 levels of cause.
  • Cross-process serialization: serializeStorageError(error) and rehydrateStorageError(json) preserve class, fields, cause, rollbackCause, and cleanupCause. Unknown subclasses rehydrate as StorageError retaining name, code, and fields.
  • Cancellation: Session listings accept an AbortSignal and reject with the signal’s reason (such as AbortError).

Errors from atomic storage join

atomic storage join, atomic storage migrate --db, atomic team status, and the SDK’s getTeamProfile() raise TeamProfileConfigError (invalid inputs; nothing changed) or TeamProfileError (runtime failure after inputs validated). Error messages name variables, flags, and file paths, never credentials. The following table lists the codes of TeamProfileConfigError: TeamProfileError carries code, subject, hint, retryable, and optional detail and cause. The following table lists its codes: In code, check these across processes with isTeamProfileError(), isTeamProfileTimeoutError(), isTeamProfileConfigError(), and isRetryableTeamProfileError() (walks up to 8 levels of cause). Use serializeTeamError(error) and rehydrateTeamError(json) to pass them across processes without credentials. POSTGRES_STORAGE_JOIN_HINT holds atomic storage join <postgres-url> --password-file <path>.