SQLSTATE 55P03lock_not_availableHTTP 500
Postgres error 55P03: lock not available
could not obtain lock on row in relation "x"
A lock was not available and the statement was told not to wait (NOWAIT) or hit lock_timeout.
Common causes
- SELECT ... FOR UPDATE NOWAIT on a row another transaction holds.
- A migration with lock_timeout set, blocked by a long-running query.
How to fix it
- Retry later, or use SKIP LOCKED for worker queues so each worker takes different rows.
- For migrations, keep lock_timeout short and retry; find blockers with pg_blocking_pids(pid).
select id from jobs where status = 'queued'
order by id
for update skip locked
limit 10;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 55P03 mean?
55P03 is lock_not_available in class 55 (Object Not In Prerequisite State). A lock was not available and the statement was told not to wait (NOWAIT) or hit lock_timeout.
How do I fix 55P03?
Retry later, or use SKIP LOCKED for worker queues so each worker takes different rows. For migrations, keep lock_timeout short and retry; find blockers with pg_blocking_pids(pid).
What HTTP status does a REST API return for 55P03?
PostgREST, the REST layer behind supabase-js, answers 500.
Other class 55 errors
- 55000 object not in prerequisite state