Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
id: 1a7b27c4df
question: 'Why do I get IndexError: list index out of range when accessing the best
chunk?'
sort_order: 2
---

The error typically happens when the number of embeddings you generate does not match the number of document chunks. Make sure you create embeddings directly from the chunk list:

```python
contents = [chunk["content"] for chunk in chunks]
X = embedder.encode_batch(contents)
```

The number of rows in `X` should be equal to `len(chunks)`.