{"record":{"id":"0f6776f0e8ef1cf1","repo":"PrefectHQ/fastmcp","slug":"both-httpx-client-factory-and-verify-were-prov","errorCode":null,"errorMessage":"Both 'httpx_client_factory' and 'verify' were provided. The 'verify' parameter will be ignored because 'httpx_client_factory' takes precedence. Configure SSL verification directly in your httpx_client_factory instead.","messagePattern":"Both 'httpx_client_factory' and 'verify' were provided\\. The 'verify' parameter will be ignored because 'httpx_client_factory' takes precedence\\. Configure SSL verification directly in your httpx_client_factory instead\\.","errorType":"console","errorClass":"UserWarning","httpStatus":null,"severity":"warning","filePath":"fastmcp_slim/fastmcp/client/transports/http.py","lineNumber":74,"sourceCode":"                enabled). Ignored when httpx_client_factory is provided.\n        \"\"\"\n        if isinstance(url, AnyUrl):\n            url = str(url)\n        if not isinstance(url, str) or not url.startswith(\"http\"):\n            raise ValueError(\"Invalid HTTP/S URL provided for Streamable HTTP.\")\n\n        # Don't modify the URL path - respect the exact URL provided by the user\n        # Some servers are strict about trailing slashes (e.g., PayPal MCP)\n\n        self.url: str = url\n        self.headers = headers or {}\n        self.httpx_client_factory = httpx_client_factory\n        self.verify: ssl.SSLContext | bool | str | None = verify\n\n        if httpx_client_factory is not None and verify is not None:\n            import warnings\n\n            warnings.warn(\n                \"Both 'httpx_client_factory' and 'verify' were provided. \"\n                \"The 'verify' parameter will be ignored because \"\n                \"'httpx_client_factory' takes precedence. Configure SSL \"\n                \"verification directly in your httpx_client_factory instead.\",\n                UserWarning,\n                stacklevel=2,\n            )\n\n        self._set_auth(auth)\n\n        # SDK v2's streamable_http_client no longer exposes a get_session_id\n        # callback. We recover the session id ourselves by capturing the\n        # `mcp-session-id` response header via an httpx event hook on the\n        # client we own (see connect_session / _capture_session_id).\n        self._session_id: str | None = None\n\n    async def _capture_session_id(self, response: httpx2.Response) -> None:\n        \"\"\"httpx response event hook: record the server's `mcp-session-id`.","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/client/transports/http.py#L56-L92","documentation":"`HttpTransport` accepts both an `httpx_client_factory` and a `verify` SSL setting. When both are supplied the factory fully determines the client, so `verify` would be silently dead — FastMCP raises a `UserWarning` and ignores `verify`.","triggerScenarios":"`HttpTransport(url, verify=False, httpx_client_factory=my_factory)` — any non-None combination of the two.","commonSituations":"Hardening TLS config while also having a custom client factory from older code; copy-pasting transport configs where a default factory was later added.","solutions":["Remove `verify=` and configure SSL inside the factory: `lambda **kw: httpx.AsyncClient(verify=False, **kw)`.","Or drop the custom `httpx_client_factory` if you only need to control `verify`.","Suppress deliberately only if the factory already handles the same verification value.","Extract shared factory/verify config into one place to prevent the conflict recurring."],"exampleFix":"// before\ntransport = HttpTransport(url, verify=False, httpx_client_factory=lambda **kw: httpx.AsyncClient(**kw))\n// after\ndef factory(**kw):\n    return httpx.AsyncClient(verify=False, **kw)\ntransport = HttpTransport(url, httpx_client_factory=factory)","handlingStrategy":"validation","validationCode":"assert not (httpx_client_factory is not None and verify is not None), \"Configure SSL in the httpx_client_factory instead of passing verify\"\n","typeGuard":null,"tryCatchPattern":"import warnings\nwith warnings.catch_warnings(record=True) as caught:\n    warnings.simplefilter(\"always\")\n    t = HttpTransport(url, verify=verify, httpx_client_factory=factory)\nif any(\"'verify' parameter will be ignored\" in str(w.message) for w in caught):\n    logging.warning(\"verify ignored; ensure factory applies SSL settings\")","preventionTips":["Set SSL config in exactly one place — preferably the client factory","Audit transport config builders for both-args combinations","Treat this UserWarning as an error in CI"],"tags":["python","ssl","httpx","transport"],"backgroundTag":"conflicting-options-ignored","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}