python
data_error
ai_generated
true
pydantic.errors.NumberError: 值不大于 100
pydantic.errors.NumberError: value is not less than or equal to 100
ID: python/pydantic-constraint-violation
80%修复率
86%置信度
0证据数
2024-02-28首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 2.x | active | — | — | — |
根因分析
带有 Field(le=100) 的数字字段接收到大于 100 的值,违反了约束。
English
A numeric field with Field(le=100) receives a value greater than 100, violating the constraint.
解决方案
-
90% 成功率
Adjust input value to meet constraint: value = min(value, 100)
-
95% 成功率
Modify Field constraint: Field(le=200)
无效尝试
常见但无效的做法:
-
50% 失败
lt means strictly less than, so 100 would still fail.
-
70% 失败
Type mismatch with constraints may cause issues.