bug: decompress_list raises IndexError on empty string input
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start in metaflow/util.py around line 387, where decompress_list accesses the first character of its input. Reproduce the failure with decompress_list(compress_list([])) and verify that the empty-list round trip returns [] without raising IndexError. Done means the valid empty-string input is handled and the existing non-empty behavior remains intact.
Written by the indexing model from the issue text.
Description
Bug Report
File: metaflow/util.py, line 387
Summary
compress_list([]) legitimately returns "" (joining an empty list).
However, decompress_list("") immediately crashes with IndexError
because lststr[0] is accessed with no guard for empty input.
This makes the natural round-trip decompress_list(compress_list([]))
crash, breaking the contract that these two functions are inverses of
each other.
Reproducer
from metaflow.util import compress_list, decompress_list
print(compress_list([])) # returns ""
decompress_list(compress_list([])) # IndexError: string index out of range
Stack trace
File "metaflow/util.py", line 387, in decompress_list
if lststr[0] == zlibmarker:
IndexError: string index out of range
**Expected behavior**
`decompress_list(compress_list([]))` returns `[]`.
**Actual behavior**
`IndexError: string index out of range` at `lststr[0]`.
**Root cause**
Line 387 accesses `lststr[0]` with no guard for empty string.
An empty task ID list is a valid real-world state.
**Environment**
- Metaflow: latest master
- Python: 3.11+
- Dominant language
- Python
- Stars
- 10.3k
- Forks
- 1.4k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Netflix/metaflow
-
Difficulty 1/5 Under an hour Newbie friendliness 91/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
All issues in Netflix/metaflow
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100