S0016: len expects an array
Generated from rellum-diagnostics/src/db.rs.
Explanation
The len built-in reports the element count of an array value. Scalars, records, enums, tuples, and function values do not carry the runtime array header that len reads, so they cannot be passed to len.
Common causes
- calling len on a String instead of an array
- calling len on a single value when an array was intended
- forgetting to wrap an item in brackets before measuring it
Canonical fixes
- pass an array value to len
Before:
count = len(item)
After:
count = len([item])
- if you need text length, convert or store text as the representation your program expects
Code example
count = len(item)