sqlmapproject/sqlmap · error · SqlmapSyntaxException

proxy value must be in format

Error message

proxy value must be in format '(%s)://address:port'

What it means

After parsing the --proxy URL, sqlmap validates that all components exist: a supported scheme (one of PROXY_TYPE's members, e.g. http/https/socks4/socks5), a hostname, and an integer port. When scheme is unknown/missing, the port is absent or non-numeric (the int() cast silently falls through), or the hostname is empty, SqlmapSyntaxException is raised showing the accepted format 'scheme://address:port'.

Solutions

  1. Supply the scheme explicitly: use `http://`, `https://`, `socks4://` or `socks5://` — a bare `host:port` is rejected.
  2. Include the port: `http://127.0.0.1:8080`, not `http://127.0.0.1`.
  3. Ensure the port is numeric; non-numeric ports are silently discarded and trip this check.
  4. Check for typos in the scheme (e.g. `socks5h` or `sock` are unsupported).
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/core/option.py:1289 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/31ec96df9ca72e97. Report an issue: GitHub.

Appendix: source

Thrown at lib/core/option.py:1289

                username, password = match.group(1), match.group(2)
            else:
                username, password = None, None

            hostnamePort = _.netloc.rsplit('@', 1)[-1].rsplit(":", 1)

            scheme = _.scheme.upper()
            hostname = hostnamePort[0]
            port = None

            if len(hostnamePort) == 2:
                try:
                    port = int(hostnamePort[1])
                except:
                    pass  # drops into the next check block

            if not all((scheme, hasattr(PROXY_TYPE, scheme), hostname, port)):
                errMsg = "proxy value must be in format '(%s)://address:port'" % "|".join(_[0].lower() for _ in getPublicTypeMembers(PROXY_TYPE))
                raise SqlmapSyntaxException(errMsg)

            if conf.proxyCred:
                _ = re.search(r"\A(.*?):(.*?)\Z", conf.proxyCred)
                if not _:
                    errMsg = "proxy authentication credentials "
                    errMsg += "value must be in format username:password"
                    raise SqlmapSyntaxException(errMsg)
                else:
                    username = _.group(1)
                    password = _.group(2)

            if scheme in (PROXY_TYPE.SOCKS4, PROXY_TYPE.SOCKS5):
                proxyHandler.proxies = {}

                if scheme == PROXY_TYPE.SOCKS4:
                    warnMsg = "SOCKS4 does not support resolving (DNS) names (i.e. causing DNS leakage)"
                    singleTimeWarnMessage(warnMsg)

View on GitHub (pinned to 0a35b20e39)