scribase
SQLSTATE 55000object_not_in_prerequisite_stateHTTP 500

Postgres error 55000: object not in prerequisite state

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 or extension feature that is not ready.

Common 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.

How to fix it

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

Through a REST API

PostgREST, the REST layer behind supabase-js and Scribase, answers HTTP 500 for this error and returns the SQLSTATE in the code field of the JSON error body.

Questions

What does Postgres error 55000 mean?

55000 is object_not_in_prerequisite_state in class 55 (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 or extension feature that is not ready.

How do I fix 55000?

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

What HTTP status does a REST API return for 55000?

PostgREST, the REST layer behind supabase-js, answers 500.

Other class 55 errors

  • 55P03 could not obtain lock on row in relation "x"