TypeError: list indices must be integers or slices, not str
- Dominant language
- Python
- Stars
- 313
- Forks
- 176
- PR merge metrics
- No merged PRs in 30d
Description
```python
# nbformat.validator.py:360
# Generate cell ids if any are missing
if repair_duplicate_cell_ids:
cell["id"] = generate_corpus_id()
changes += 1
```
Where
```python
# nbformat.corpus.words
"""Generate a corpus id."""
from __future__ import annotations
import uuid
def generate_corpus_id():
"""Generate a corpus id."""
return uuid.uuid4().hex[:8]
```
The line:
```python
cell["id"] = generate_corpus_id()
```
Yields:
```python
TypeError: list indices must be integers or slices, not str
```
Which will always be a string since `uuid.uuid4().hex[:8]` is a string.
Contributor guide
Research direction
Start in nbformat.validator.py around line 360 and inspect how the cell value reaches the cell["id"] assignment. Read nbformat.corpus.words to confirm the generated ID type, then reproduce the reported validation path. Done means the reported input no longer raises the TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100