go
data_error
ai_generated
true
sql: no rows in result set
ID: go/sql-no-rows
80%Fix Rate
90%Confidence
0Evidence
2024-03-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.21 | active | — | — | — |
Root Cause
查询条件不匹配任何记录,但代码期望至少有一行。
generic中文
查询条件不匹配任何记录,但代码期望至少有一行。
Workarounds
-
90% success
使用sql.ErrNoRows判断并处理空结果。
Dead Ends
Common approaches that don't work:
-
60% fail
忽略错误可能导致空指针引用。
-
50% fail
修改查询条件但业务逻辑未变,仍可能失败。