# Postgres error 55000: object not in prerequisite state

> The object is not in the state the command needs — for example a sequence used before nextval, or a replication slot that is not ready.

Source: https://scribase.com/postgres-errors/55000

SQLSTATE class: Object Not In Prerequisite State. Over PostgREST/supabase-js this maps to HTTP 500.

## Causes

- currval() called before nextval() in this session.
- Logical replication commands when wal_level is not logical.
- Extension functions that need a preloaded library that is not loaded.

## Fixes

- Use the value returned by INSERT ... RETURNING id instead of currval.
- Read the full message; it names the prerequisite.