Skip to content

fix(chroma): raise ValueError when async client is passed to Chroma#36950

Closed
anish (anishesg) wants to merge 1 commit intolangchain-ai:masterfrom
anishesg:fix/ph-issue-30704
Closed

fix(chroma): raise ValueError when async client is passed to Chroma#36950
anish (anishesg) wants to merge 1 commit intolangchain-ai:masterfrom
anishesg:fix/ph-issue-30704

Conversation

@anishesg
Copy link
Copy Markdown

@anishesg anish (anishesg) commented Apr 22, 2026

Closes #30704


Passing a chromadb.AsyncHttpClient to the Chroma constructor causes a confusing AttributeError: 'coroutine' object has no attribute 'get_or_create_collection'. This happens because AsyncHttpClient is an async factory that returns a coroutine, and the sync __ensure_collection method tries to call .get_or_create_collection() on it directly.

This adds early validation in __init__ to detect two cases:

  • An unawaited AsyncHttpClient(...) call (a coroutine object)
  • An awaited AsyncClientAPI instance

Both now raise a ValueError with a clear message pointing the user to chromadb.HttpClient as the synchronous alternative.

@github-actions github-actions Bot added chroma `langchain-chroma` package issues & PRs fix For PRs that implement a fix integration PR made that is related to a provider partner package integration size: XS < 50 LOC labels Apr 22, 2026
@github-actions
Copy link
Copy Markdown

This PR has been automatically closed because you are not assigned to the linked issue.

External contributors must be assigned to an issue before opening a PR for it. Please:

  1. Comment on the linked issue to request assignment from a maintainer
  2. Once assigned, your PR will be reopened automatically

Maintainers: reopen this PR or remove the missing-issue-link label to bypass this check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chroma `langchain-chroma` package issues & PRs external fix For PRs that implement a fix integration PR made that is related to a provider partner package integration missing-issue-link new-contributor size: XS < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

langchain_chroma.Chroma used with chromadb.AsyncHttpClient?

2 participants