sqlmapproject/sqlmap · error · SqlmapValueException
wrong number of columns used in replicating insert
Error message
wrong number of columns used in replicating insert
What it means
SqlmapValueException raised in Replication.Table.insert: the number of values in the row does not match the number of columns declared for the replicated table, indicating an internal data-shape mismatch.
Solutions
- Ensure each inserted row has exactly as many values as the declared columns
- Check the column definition passed when creating the table
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/core/replication.py:84 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26).
Data as JSON: /api/errors/56470d89ecd5dfcb.
Report an issue: GitHub.
Appendix: source
Thrown at lib/core/replication.py:84
if not typeless:
self.execute('CREATE TABLE "%s" (%s)' % (self.name, ','.join('"%s" %s' % (unsafeSQLIdentificatorNaming(colname), coltype) for colname, coltype in self.columns)))
else:
self.execute('CREATE TABLE "%s" (%s)' % (self.name, ','.join('"%s"' % unsafeSQLIdentificatorNaming(colname) for colname in self.columns)))
except Exception as ex:
errMsg = "problem occurred ('%s') while initializing the sqlite database " % getSafeExString(ex, UNICODE_ENCODING)
errMsg += "located at '%s'" % self.parent.dbpath
raise SqlmapGenericException(errMsg)
def insert(self, values):
"""
This function is used for inserting row(s) into current table.
"""
if len(values) == len(self.columns):
self.execute('INSERT INTO "%s" VALUES (%s)' % (self.name, ','.join(['?'] * len(values))), safechardecode(values))
else:
errMsg = "wrong number of columns used in replicating insert"
raise SqlmapValueException(errMsg)
def execute(self, sql, parameters=None):
try:
try:
self.parent.cursor.execute(sql, parameters or [])
except UnicodeError:
self.parent.cursor.execute(sql, cleanReplaceUnicode(parameters or []))
except sqlite3.OperationalError as ex:
errMsg = "problem occurred ('%s') while accessing sqlite database " % getSafeExString(ex, UNICODE_ENCODING)
errMsg += "located at '%s'. Please make sure that " % self.parent.dbpath
errMsg += "it's not used by some other program"
raise SqlmapGenericException(errMsg)
def beginTransaction(self):
"""
Great speed improvement can be gained by using explicit transactions around multiple inserts.
Reference: http://stackoverflow.com/questions/4719836/python-and-sqlite3-adding-thousands-of-rows
"""View on GitHub (pinned to 0a35b20e39)