{"record":{"id":"39e2d8d8e8deb02b","repo":"sqlmapproject/sqlmap","slug":"invalid-header-value-s-valid-header-format-is","errorCode":null,"errorMessage":"invalid header value: %s. Valid header format is 'name:value'","messagePattern":"invalid header value: (.+?)\\. Valid header format is 'name:value'","errorType":"exception","errorClass":"SqlmapSyntaxException","httpStatus":null,"severity":"error","filePath":"lib/core/option.py","lineNumber":1580,"sourceCode":"            conf.headers = conf.headers.replace(\"\\\\r\\\\n\", \"\\\\n\").split(\"\\\\n\")\n        else:\n            conf.headers = conf.headers.replace(\"\\r\\n\", \"\\n\").split(\"\\n\")\n\n        for headerValue in conf.headers:\n            if not headerValue.strip():\n                continue\n\n            if headerValue.startswith('@'):\n                checkFile(headerValue[1:])\n                kb.headersFile = headerValue[1:]\n            elif headerValue.count(':') >= 1:\n                header, value = (_.lstrip() for _ in headerValue.split(\":\", 1))\n\n                if header and value:\n                    conf.httpHeaders.append((header, value))\n            else:\n                errMsg = \"invalid header value: %s. Valid header format is 'name:value'\" % repr(headerValue).lstrip('u')\n                raise SqlmapSyntaxException(errMsg)\n\n    elif not conf.requestFile and len(conf.httpHeaders or []) < 2:\n        if conf.encoding:\n            conf.httpHeaders.append((HTTP_HEADER.ACCEPT_CHARSET, \"%s;q=0.7,*;q=0.1\" % conf.encoding))\n\n        # Invalidating any caching mechanism in between\n        # Reference: http://stackoverflow.com/a/1383359\n        conf.httpHeaders.append((HTTP_HEADER.CACHE_CONTROL, \"no-cache\"))\n\ndef _setHTTPUserAgent():\n    \"\"\"\n    Set the HTTP User-Agent header.\n    Depending on the user options it can be:\n\n        * The default sqlmap string\n        * A default value read as user option\n        * A random value read from a list of User-Agent headers from a\n          file choosed as user option","sourceCodeStart":1562,"sourceCodeEnd":1598,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/lib/core/option.py#L1562-L1598","documentation":"_setHTTPExtraHeaders splits the --headers value into lines and validates each line: blank lines are skipped, lines starting with '@' are treated as header files, and everything else must contain at least one colon separating a non-empty header name from a non-empty value. A line failing that shape — missing colon, empty name/value, or a stray fragment — raises this SqlmapSyntaxException showing the offending line.","triggerScenarios":"Thrown at lib/core/option.py:1580 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Format each header as `Name: value`, e.g. `--headers=\"X-Forwarded-For: 127.0.0.1\"`.","Separate multiple headers with newlines: `--headers=\"Header1: v1\\nHeader2: v2\"`.","Ensure both name and value are non-empty; remove trailing colons or empty lines.","To load headers wholesale, use `@/path/to/headers.txt` pointing to an existing file instead of inline lines."],"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"}