sqlmapproject/sqlmap · error · SqlmapConnectionException
error occurred while opening a session file
Error message
error occurred while opening a session file '%s' ('%s') What it means
Opening a per-thread SQLite connection to the session/hash DB failed (locked by another process, missing/unwritable path, or sqlite-level error); cursor creation aborts rather than silently disabling session storage.
Solutions
- Check permissions on the session file and its directory
- Rerun with '--flush-session' to recreate a fresh session DB
- Remove stale lock/WAL files left by a crashed process
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at lib/utils/hashdb.py:61 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/6a6d5e6e2cad74af.
Report an issue: GitHub.
Appendix: source
Thrown at lib/utils/hashdb.py:61
def _get_cursor(self):
threadData = getCurrentThreadData()
if threadData.hashDBCursor is None:
try:
connection = sqlite3.connect(self.filepath, timeout=10, isolation_level=None, check_same_thread=False)
if not IS_PYPY:
connection.execute("PRAGMA journal_mode=WAL")
connection.execute("PRAGMA synchronous=NORMAL")
connection.execute("PRAGMA busy_timeout=10000")
self._connections.append(connection)
threadData.hashDBCursor = connection.cursor()
threadData.hashDBCursor.execute("CREATE TABLE IF NOT EXISTS storage (id INTEGER PRIMARY KEY, value TEXT)")
connection.commit()
except Exception as ex:
errMsg = "error occurred while opening a session "
errMsg += "file '%s' ('%s')" % (self.filepath, getSafeExString(ex))
raise SqlmapConnectionException(errMsg)
return threadData.hashDBCursor
def _set_cursor(self, cursor):
threadData = getCurrentThreadData()
threadData.hashDBCursor = cursor
cursor = property(_get_cursor, _set_cursor)
def close(self):
threadData = getCurrentThreadData()
try:
if threadData.hashDBCursor:
if self._write_cache:
self.flush()
threadData.hashDBCursor.close()
threadData.hashDBCursor.connection.close()View on GitHub (pinned to 0a35b20e39)