chroma-core / chroma-core/chroma
[BUG](cli): subcommand is unreachable due to incorrect list membership check
- Dominant language
- Rust
- Stars
- 29.3k
- Forks
- 2.5k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 38
Description
## Problem
In `chromadb/cli/cli.py` line 50:
```python
def app():
args = sys.argv
if ["chroma", "update"] in args:
update()
return
```
`["chroma", "update"] in args` checks if the **list** `["chroma", "update"]` is an element of `sys.argv`. Since `sys.argv` contains only strings, this is **always `False`** — the `update()` function can never be called.
When a user runs `chroma update`, `sys.argv` is `["chroma", "update"]`. The `in` operator checks if `["chroma", "update"]` (a list) is one of the elements — but the elements are `"chroma"` (str) and `"update"` (str), never a list. So the check silently falls through to the Rust CLI.
## Fix
Replace with a proper subcommand check:
```python
if args[1:2] == ["update"]:
```
Using slice `args[1:2]` avoids `IndexError` if `sys.argv` has only one element (no subcommand).
## Affected File
- `chromadb/cli/cli.py:50`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at app() in chromadb/cli/cli.py around line 50 and inspect how sys.argv dispatches subcommands. Verify that running chroma update calls update(), while invoking the CLI without a subcommand does not raise an IndexError and still follows the normal path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100