sqlmapproject/sqlmap · error · SqlmapConnectionException

problem occurred while resolving a host name

Error message

problem occurred while resolving a host name '%s' ('%s')

What it means

checkConnection wraps any socket.error (non-gaierror) from resolving the target hostname into this message, including the OS error detail. Unlike 'does not exist' (definitive NXDOMAIN), this covers transient resolver/socket failures — timeouts, unreachable resolvers, no routes — during the pre-flight connectivity check.

Solutions

  1. Check network connectivity and that the configured DNS server is reachable.
  2. Inspect the embedded OS error text for the root cause (timeout, refused, no route).
  3. Retry; transient resolver outages resolve themselves.
  4. Bypass DNS by targeting the IP directly or use --proxy so resolution occurs elsewhere.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at lib/controller/checks.py:1763 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/5de396eb674dc4f9. Report an issue: GitHub.

Appendix: source

Thrown at lib/controller/checks.py:1763

    return kb.nullConnection in getPublicTypeMembers(NULLCONNECTION, True)

def checkConnection(suppressOutput=False):
    threadData = getCurrentThreadData()

    if not re.search(r"\A\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\Z", conf.hostname):
        if not any((conf.proxy, conf.tor, conf.dummy, conf.offline)):
            try:
                debugMsg = "resolving hostname '%s'" % conf.hostname
                logger.debug(debugMsg)
                socket.getaddrinfo(conf.hostname, None)
            except socket.gaierror:
                errMsg = "host '%s' does not exist" % conf.hostname
                raise SqlmapConnectionException(errMsg)
            except socket.error as ex:
                errMsg = "problem occurred while "
                errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
                raise SqlmapConnectionException(errMsg)
            except UnicodeError as ex:
                errMsg = "problem occurred while "
                errMsg += "handling a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
                raise SqlmapDataException(errMsg)

    if not suppressOutput and not conf.dummy and not conf.offline:
        infoMsg = "testing connection to the target URL"
        logger.info(infoMsg)

    try:
        kb.originalPageTime = time.time()
        page, headers, _ = Request.queryPage(content=True, noteResponseTime=False)

        rawResponse = "%s%s" % (listToStrValue(headers.headers if headers else ""), page)

        if conf.string:
            infoMsg = "testing if the provided string is within the "
            infoMsg += "target URL page content"

View on GitHub (pinned to 0a35b20e39)