sqlmapproject/sqlmap · error · SqlmapConnectionException
error occurred while accessing session file
Error message
error occurred while accessing session file '%s' ('%s'). If the problem persists please rerun with '--flush-session' What it means
Raised in HashDB.retrieve when repeated SELECT attempts keep failing with sqlite operational/database errors ('locked', missing table, corruption) — the session file is persistently inaccessible despite retries.
Solutions
- Rerun with '--flush-session' as the message advises
- Ensure no other sqlmap process is using the same session file concurrently
- Move or delete the corrupted session DB so a new one is created
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at lib/utils/hashdb.py:124 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/fedaa4e50e0993d4.
Report an issue: GitHub.
Appendix: source
Thrown at lib/utils/hashdb.py:124
if retVal is None:
retVal = self._read_cache.get(hash_)
if retVal is None:
for _ in xrange(HASHDB_RETRIEVE_RETRIES):
try:
for row in self.cursor.execute("SELECT value FROM storage WHERE id=?", (hash_,)):
retVal = row[0]
except (sqlite3.OperationalError, sqlite3.DatabaseError) as ex:
if any(_ in getSafeExString(ex) for _ in ("locked", "no such table")):
warnMsg = "problem occurred while accessing session file '%s' ('%s')" % (self.filepath, getSafeExString(ex))
singleTimeWarnMessage(warnMsg)
elif "Could not decode" in getSafeExString(ex):
break
else:
errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, getSafeExString(ex))
errMsg += "If the problem persists please rerun with '--flush-session'"
raise SqlmapConnectionException(errMsg)
else:
break
time.sleep(1)
if retVal is not None:
self._read_cache[hash_] = retVal
if retVal and unserialize:
try:
retVal = unserializeObject(retVal)
except:
retVal = None
warnMsg = "error occurred while unserializing value for session key '%s'. " % key
warnMsg += "If the problem persists please rerun with '--flush-session'"
logger.warning(warnMsg)
return retValView on GitHub (pinned to 0a35b20e39)