qdrant / qdrant/qdrant-client

Error initializing QdrantClient when passing SSLContext

Open
#970 3 comments 0 reactions 1 assignee View on GitHub

@joein is already working on this.

Since May 19, 2025.

bug
Dominant language
Python
Stars
1.4k
Forks
301
Avg merge
2d 9h
Merged PRs (30d)
37

Description

In #541, init_options was added to QdrantClient, as part of that, it makes a deepcopy of the QDrantClient kwargs. Unfortunately, some keyword args cannot be deep copied (see error message). In my case, I have to pass in verify=<a SSLContext object> as a kwarg, but doing so prevents me from creating an instance of QdrantClient.
Note also, httpx removed support for using strings for the verify and cert args in httpx==0.28.0.

Current Behavior

Creating an instance of QdrantClient using SSLContext as kwarg raises an error

File "/usr/lib/python3.12/copy.py", line 151, in deepcopy
rv = reductor(4)
^^^^^^^^^^^
TypeError: cannot pickle 'SSLContext' object

Steps to Reproduce

import ssl

from qdrant_client import QdrantClient

if __name__ == "__main__":
    QdrantClient(url="https://example.com/", verify=ssl.create_default_context())
Traceback (most recent call last):
  File "test.py", line 7, in <module>
    QdrantClient(url="https://example.com/", verify=ssl_context)
  File "python3.12/site-packages/qdrant_client/qdrant_client.py", line 115, in __init__
    self._init_options.update(deepcopy(kwargs))
                              ^^^^^^^^^^^^^^^^
  File "python3.12/copy.py", line 136, in deepcopy
    y = copier(x, memo)
        ^^^^^^^^^^^^^^^
  File "python3.12/copy.py", line 221, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
                             ^^^^^^^^^^^^^^^^^^^^^
  File "python3.12/copy.py", line 151, in deepcopy
    rv = reductor(4)
         ^^^^^^^^^^^
TypeError: cannot pickle 'SSLContext' object

Expected Behavior

Should successfully create a client instance without error.

Possible Solution

Remove below deepcopy code or handle deepcopy of 'SSLContext' correctly in the below code in a try/except block.
github.com/qdrant/qdrant-client/blob/master/qdrant_client/qdrant_client.py#L118

Context (Environment)

qdrant-client 1.13.0
httpx 0.28.1
python 3.12

Detailed Description

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.