{"record":{"id":"32c4ce5f10c79d8b","repo":"sqlmapproject/sqlmap","slug":"could-not-connect-to-s-s-s-32c4ce","errorCode":null,"errorMessage":"could not connect to '%s:%s' (%s)","messagePattern":"could not connect to '(.+?):(.+?)' \\((.+?)\\)","errorType":"exception","errorClass":"OperationalError","httpStatus":null,"severity":"error","filePath":"extra/dbwire/postgres.py","lineNumber":307,"sourceCode":"            except (KeyError, binascii.Error, ValueError) as ex:\n                raise OperationalError(\"malformed SCRAM server signature (%s)\" % ex)\n            server_key = hmac.new(salted, b\"Server Key\", hashlib.sha256).digest()\n            expected = hmac.new(server_key, auth_message.encode(\"ascii\"), hashlib.sha256).digest()\n            if not hmac.compare_digest(signature, expected):\n                raise OperationalError(\"SCRAM server signature mismatch (rogue server?)\")\n        else:\n            raise InterfaceError(\"unsupported authentication request %d\" % code)\n\ndef _raise_server_error_as_operational(payload):\n    message, _ = _error_message(payload)\n    raise OperationalError(\"(remote) %s\" % message)\n\ndef connect(host=None, port=5432, user=None, password=None, database=None, connect_timeout=None, **kwargs):\n    try:\n        sock = socket.create_connection((host or \"localhost\", int(port or 5432)), timeout=connect_timeout)\n        keepalive(sock)\n    except (socket.error, socket.timeout) as ex:\n        raise OperationalError(\"could not connect to '%s:%s' (%s)\" % (host, port, ex))\n\n    params = b\"\"\n    for key, value in ((\"user\", user or \"\"), (\"database\", database or user or \"\"), (\"client_encoding\", \"UTF8\")):\n        params += key.encode(\"ascii\") + b\"\\x00\" + (\"%s\" % value).encode(\"utf-8\") + b\"\\x00\"\n    params += b\"\\x00\"\n\n    try:\n        _send(sock, b\"\", struct.pack(\"!I\", _PROTOCOL_VERSION) + params)  # StartupMessage\n        _authenticate(sock, user, password)\n        while True:  # drain until ReadyForQuery (ParameterStatus/BackendKeyData/NoticeResponse)\n            mtype, payload = _read_message(sock)\n            if mtype == b\"E\":\n                _raise_server_error_as_operational(payload)\n            if mtype == b\"Z\":\n                break\n        handshake_done(sock)\n    except Exception:  # any setup failure (DB-API or otherwise) must still close the socket\n        try:","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/extra/dbwire/postgres.py#L289-L325","documentation":"Error \"could not connect to '%s:%s' (%s)\" thrown in sqlmapproject/sqlmap.","triggerScenarios":"Thrown at extra/dbwire/postgres.py:307 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"}