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
DirectSqliteDatabase 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, andisStorageError. Code lists:STORAGE_TRANSIENT_ERROR_CODES,SESSION_BLOB_ERROR_CODES, andSESSION_SPILL_ERROR_CODES. - Cause-chain inspection:
findStorageWriteLockTimeoutError(error)andisRetryableStorageError(error)inspect up to 8 levels ofcause. - Cross-process serialization:
serializeStorageError(error)andrehydrateStorageError(json)preserve class, fields,cause,rollbackCause, andcleanupCause. Unknown subclasses rehydrate asStorageErrorretainingname,code, and fields. - Cancellation: Session listings accept an
AbortSignaland reject with the signal’sreason(such asAbortError).
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>.