{"record":{"id":"9c425e7f5004d6a7","repo":"sqlmapproject/sqlmap","slug":"error-occurred-while-writing-to-log-file-s","errorCode":null,"errorMessage":"error occurred while writing to log file ('%s')","messagePattern":"error occurred while writing to log file \\('(.+?)'\\)","errorType":"exception","errorClass":"SqlmapGenericException","httpStatus":null,"severity":"error","filePath":"lib/core/dump.py","lineNumber":97,"sourceCode":"    def _write(self, data, newline=True, console=True, content_type=None):\n        text = \"%s%s\" % (data, \"\\n\" if newline else \" \")\n\n        if conf.api:\n            dataToStdout(data, contentType=content_type, status=CONTENT_STATUS.COMPLETE)\n\n        elif console:\n            dataToStdout(text)\n\n        if self._outputFP:\n            multiThreadMode = kb.multiThreadMode\n            if multiThreadMode:\n                self._lock.acquire()\n\n            try:\n                self._outputFP.write(text)\n            except IOError as ex:\n                errMsg = \"error occurred while writing to log file ('%s')\" % getSafeExString(ex)\n                raise SqlmapGenericException(errMsg)\n            finally:\n                if multiThreadMode:\n                    self._lock.release()\n\n        kb.dataOutputFlag = True\n\n    def _reportData(self, data, content_type):\n        \"\"\"\n        --report-json: capture a structured result exactly as the REST API would store it (the raw\n        value + COMPLETE status), independent of console/file rendering. No-op unless a report\n        collector is active - which is only ever the case for a CLI --report-json run, never under\n        --api - so this never double-captures alongside StdDbOut. A None content_type is resolved\n        via the kb.partRun fallback (e.g. the fingerprint line), mirroring the API exactly.\n        \"\"\"\n\n        if conf.get(\"reportCollector\") is not None:\n            from lib.utils.api import _storeData, REPORT_TASKID\n            _storeData(conf.reportCollector, REPORT_TASKID, stdoutEncode(clearColors(data)), CONTENT_STATUS.COMPLETE, content_type)","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/lib/core/dump.py#L79-L115","documentation":"Error \"error occurred while writing to log file ('%s')\" thrown in sqlmapproject/sqlmap.","triggerScenarios":"Thrown at lib/core/dump.py:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a35b20e3953d341be6c7ac75ccb0b3362540c8d","analyzedAt":"2026-08-26T23:02:52.002Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}