python
type_error
ai_generated
true
fastapi.exceptions.RequestValidationError: [{'loc': ['query', 'tags'], 'msg': 'value is not a valid list', 'type': 'type_error.list'}]
ID: python/fastapi-query-param-list-error
80%Fix Rate
89%Confidence
0Evidence
2024-07-07First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
A query parameter is declared as List[str] but the client sends a single string without repeated parameters.
generic中文
查询参数声明为 List[str],但客户端发送单个字符串而未重复参数。
Workarounds
-
100% success
Send multiple query parameters: /path?tags=a&tags=b
-
80% success
Use a string and parse it: tags: str = Query(""), then tags.split(",")
Dead Ends
Common approaches that don't work:
-
50% fail
This is not standard and may break URL encoding.
-
70% fail
The validation still fails because the value is not a list.