gastownhall/beads · warning
journal: close dependency removals from %s: %w
Error message
journal: close dependency removals from %s: %w
What it means
This error is returned when rows.Close() fails after successfully iterating dependency-removal rows in dependencyEdgesInTableForIssueIDsInTx. Closing a rows handle releases database resources, and a close failure usually signals an already-broken connection. The library surfaces it because leaking cursors on journal tables can exhaust server resources.
Source
Thrown at internal/storage/issueops/journal_dependencies.go:108
if optionalBlockedTable(table) && isTableNotExistError(err) {
continue
}
return nil, fmt.Errorf("journal: query dependency removals from %s: %w", table, err)
}
for rows.Next() {
var edge journalDependencyEdge
if err := rows.Scan(&edge.source, &edge.target, &edge.kind, &edge.metadata); err != nil {
_ = rows.Close()
return nil, fmt.Errorf("journal: scan dependency removal from %s: %w", table, err)
}
byKey[dependencyEdgeKey(edge)] = edge
}
if err := rows.Err(); err != nil {
_ = rows.Close()
return nil, fmt.Errorf("journal: iterate dependency removals from %s: %w", table, err)
}
if err := rows.Close(); err != nil {
return nil, fmt.Errorf("journal: close dependency removals from %s: %w", table, err)
}
}
return sortedDependencyEdges(byKey), nil
}
func dependencyEdgeKey(edge journalDependencyEdge) string {
return edge.source + "\x00" + edge.target + "\x00" + edge.kind + "\x00" + edge.metadata
}
func sortedDependencyEdges(byKey map[string]journalDependencyEdge) []journalDependencyEdge {
edges := make([]journalDependencyEdge, 0, len(byKey))
for _, edge := range byKey {
edges = append(edges, edge)
}
sort.Slice(edges, func(i, j int) bool {
if edges[i].source != edges[j].source {
return edges[i].source < edges[j].source
}View on GitHub (pinned to 71377f2769)
Solutions
- Verify connection health and retry; this is often transient
- Check the wrapped driver error for ErrBadConn and let the pool replace the connection
- Ensure connection pool settings (MaxLifetime) are shorter than any network idle timeouts
Defensive patterns
Strategy: retry
Validate before calling
// no pre-call validation possible; verify pool health instead
if db == nil { return errors.New("nil DB handle before dependency rebuild") } Try / catch
if err != nil && errors.Is(err, driver.ErrBadConn) {
// let sql.DB replace the connection and retry once
} Prevention
- Set conn MaxIdleTime/MaxLifetime below network idle timeouts
- Avoid holding transactions across long computations
- Let database/sql pool manage connections rather than caching handles
When it happens
Trigger: RecordDependencyRemovalsForTableInTx or dependencyEdgesForIssueIDsInTx call paths where the database connection has gone bad by the time rows.Close() is called after iteration completes.
Common situations: Network interruptions to a remote Dolt server; connection-pool recycling a broken connection; driver ErrBadConn surfacing at close time.
Related errors
- capture dependency edges for rename %s -> %s: %w
- journal: query dependency removals from %s: %w
- journal: scan dependency removal from %s: %w
- journal: iterate dependency removals from %s: %w
- loading deps for %s: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/2d62f073326b538a.
Report an issue: GitHub.