Prepared statement parameter count mismatch (placeholders vs bound values)
The number of ?/$1/:name placeholders doesn't match the values you bound.
Incorrect number of bindings suppliedThe current statement uses 2, and there are 1 suppliedParameter count mismatchbind message supplies 1 parameters, but prepared statement requires 2Not all parameters were used in the SQL statement Meaning
Typical in dynamically built queries: too many or too few values, a named parameter missing, or a literal ? in a string/JSON operator being treated as a placeholder. Count the placeholders, log the final SQL and parameters, and escape literal question marks (??, or use jsonb_exists).
Common causes
- Placeholder count differs from the bound values
- Dynamic WHERE building skipping a bind
- Literal ? in the query text
- Named parameter missing from the map
- IN list expanded incorrectly
⚡ Quick fix
- Match placeholders and values exactly
- Log SQL together with parameters
- Escape literal
?or use named parameters
Detailed fix by platform
Python
cur.execute("SELECT * FROM t WHERE a = %s AND b = %s", (a, b)) # two placeholders, two values
How to diagnose
- Placeholders — Count?
- Values — Count?
- Literal ? — Present?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in SQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026