{"record":{"id":"956fa1dd5c863a3d","repo":"sqlmapproject/sqlmap","slug":"invalid-format-of-a-safe-request-file","errorCode":null,"errorMessage":"invalid format of a safe request file","messagePattern":"invalid format of a safe request file","errorType":"exception","errorClass":"SqlmapSyntaxException","httpStatus":null,"severity":"error","filePath":"lib/core/option.py","lineNumber":1417,"sourceCode":"                            value = \"%s://%s\" % (scheme, value)\n                        kb.safeReq.url = _urllib.parse.urljoin(value, kb.safeReq.url)\n                else:\n                    break\n\n            post = None\n\n            if '\\r\\n\\r\\n' in raw:\n                post = raw[raw.find('\\r\\n\\r\\n') + 4:]\n            elif '\\n\\n' in raw:\n                post = raw[raw.find('\\n\\n') + 2:]\n\n            if post and post.strip():\n                kb.safeReq.post = post\n            else:\n                kb.safeReq.post = None\n        else:\n            errMsg = \"invalid format of a safe request file\"\n            raise SqlmapSyntaxException(errMsg)\n    else:\n        if not re.search(r\"(?i)\\Ahttp[s]*://\", conf.safeUrl):\n            if \":443/\" in conf.safeUrl:\n                conf.safeUrl = \"https://%s\" % conf.safeUrl\n            else:\n                conf.safeUrl = \"http://%s\" % conf.safeUrl\n\n    if (conf.safeFreq or 0) <= 0:\n        errMsg = \"please provide a valid value (>0) for safe frequency ('--safe-freq') while using safe visit features\"\n        raise SqlmapSyntaxException(errMsg)\n\ndef _setPrefixSuffix():\n    if conf.prefix is not None and conf.suffix is not None:\n        # Create a custom boundary object for user's supplied prefix\n        # and suffix\n        boundary = AttribDict()\n\n        boundary.level = 1","sourceCodeStart":1399,"sourceCodeEnd":1435,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/lib/core/option.py#L1399-L1435","documentation":"_setSafeVisit parses the file given via --safe-req as a raw HTTP request (request line, headers, blank line, optional body). If the raw content cannot be interpreted as a valid HTTP request — no valid request line/URL, unparseable headers — the parser bails and this SqlmapSyntaxException is raised; the sentinel guard catches an input file that is not a serialized HTTP request.","triggerScenarios":"Thrown at lib/core/option.py:1417 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Capture the file from a real request, e.g. with Burp: right-click > 'Copy to file' > 'items', or save a raw request from the proxy history.","Ensure the file starts with a proper request line like `GET /path HTTP/1.1` followed by `Host:` and other headers, then a blank line, then the body.","Use CRLF (\\r\\n) line endings as in a real HTTP request; avoid editing the file with tools that mangle the format.","Verify the file is not empty, HTML-pasted, or URL-encoded-only content — it must be a raw request dump."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a35b20e3953d341be6c7ac75ccb0b3362540c8d","analyzedAt":"2026-08-26T23:02:52.002Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}