SQLITE_CONSTRAINT_COMMITHOOK
SQLiteWARNINGNotableConstraintofficial confidence

Commit hook requested rollback

Production Risk

Medium — transaction rolled back by application design.

What this means

SQLITE_CONSTRAINT_COMMITHOOK (531) is returned when a commit-hook callback (registered via sqlite3_commit_hook()) returns non-zero, requesting that the transaction be rolled back.

Why it happens
  1. 1Application commit hook returned non-zero to veto the commit.
  2. 2Custom validation logic in the commit hook rejected the transaction.
How to reproduce

COMMIT when a registered commit hook returns non-zero.

trigger — this will error
trigger — this will error
# In C:
# sqlite3_commit_hook(db, myCommitHook, NULL);
# If myCommitHook() returns 1 → SQLITE_CONSTRAINT_COMMITHOOK

expected output

sqlite3.OperationalError: constraint failed

Fix 1

Fix 2

Sources
Official documentation ↗

sqlite3.h — SQLITE_CONSTRAINT_COMMITHOOK = 531

sqlite3_commit_hook()

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All SQLite errors