sqlmapproject/sqlmap · error · SqlmapGenericException
error occurred while writing to log file
Error message
error occurred while writing to log file ('%s') What it means
Raised in Dump._write when the session log file under conf.outputPath cannot be written: self._outputFP.write(text) raised IOError (disk full, revoked permissions, deleted file handle) while echoing results to the log.
Solutions
- Check disk space and write permissions on the output directory
- Ensure no other process or antivirus is holding/deleting the log file
- Restart the run with a fresh --output directory if the handle went stale
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at lib/core/dump.py:97 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/9c425e7f5004d6a7.
Report an issue: GitHub.
Appendix: source
Thrown at lib/core/dump.py:97
def _write(self, data, newline=True, console=True, content_type=None):
text = "%s%s" % (data, "\n" if newline else " ")
if conf.api:
dataToStdout(data, contentType=content_type, status=CONTENT_STATUS.COMPLETE)
elif console:
dataToStdout(text)
if self._outputFP:
multiThreadMode = kb.multiThreadMode
if multiThreadMode:
self._lock.acquire()
try:
self._outputFP.write(text)
except IOError as ex:
errMsg = "error occurred while writing to log file ('%s')" % getSafeExString(ex)
raise SqlmapGenericException(errMsg)
finally:
if multiThreadMode:
self._lock.release()
kb.dataOutputFlag = True
def _reportData(self, data, content_type):
"""
--report-json: capture a structured result exactly as the REST API would store it (the raw
value + COMPLETE status), independent of console/file rendering. No-op unless a report
collector is active - which is only ever the case for a CLI --report-json run, never under
--api - so this never double-captures alongside StdDbOut. A None content_type is resolved
via the kb.partRun fallback (e.g. the fingerprint line), mirroring the API exactly.
"""
if conf.get("reportCollector") is not None:
from lib.utils.api import _storeData, REPORT_TASKID
_storeData(conf.reportCollector, REPORT_TASKID, stdoutEncode(clearColors(data)), CONTENT_STATUS.COMPLETE, content_type)View on GitHub (pinned to 0a35b20e39)